[Numpy-discussion] Matlab -> NumPy translation and indexing
Thu Mar 15 06:26:10 CDT 2007
On 3/14/07, Gael Varoquaux <email@example.com> wrote:
> I definitely second this comment. Using arrays when you are trying to
> append a lot of data is using the wrong data format. And the code is so
> much more readable with lists.
I will consider it,
Next thing, I have
A_Idx = array([1, 0])
and B is a matrix. How would I select the four elements in B indicated by
"meshgrid(A_Idx)", that ist: B[1,1], B[1,0], B[0,1], B[0,0]
In Matlab you would simply use B(A_idx, A_idx) whereas in NumPy B[A_Idx,
A_idx] returns B[1,1] and B[0,0] only.
I read that A.take(A_idx).take(A_idx, axis = 1) should work but it doesn't.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion