problems with duplicating and slicing an array

2005-01-20 Thread Yun Mao
Hi python gurus, I have some questions when I'm using python numeric: 1. When I do v = u[:, :], it seems u and v still point to the same memory. e.g. When I do v[1,1]=0, u[1,1] will be zero out as well. What's the right way to duplicate an array? Now I have to do v = dot(u, identity(N)), which

Re: problems with duplicating and slicing an array

2005-01-20 Thread Yun Mao
Hi all, Thanks for the help. numarray doesn't provide what I look for either. e.g. a = array( [[1,2,3],[4,5,6]] ) I sometimes what this: a[ [1,0], :], or even a[ [1,0], [0,1] ] , which should give me [[4, 5], [1,2]] Because I don't really care about arrays with dimension >2, I did a little h