[Numpy-discussion] n-dimensional array indexing question

dmitrey dmitrey.kroshko@scipy....
Sat Nov 8 16:35:20 CST 2008


hi all,
I have array A, A.ndim = n, and 1-dimensional array B of length n.
How can I get element of A with coords B[0],...,B[n-1]?
i.e. A[B[0], B[1], ..., B[n-1])

A, B, n are not known till execution time, and can have unpredictable 
lengths (still n is usually small, no more than 4-5).

I have tried via ix_ but haven't succeeded yet.

Thx in advance, D.


More information about the Numpy-discussion mailing list