[Numpy-discussion] Is there a way that indexing a matrix of data with a matrix of indices?
ZHUO QL (KDr2)
zhuoql at yahoo.com
Wed Nov 29 09:56:28 EST 2017
- D, is the data matrix, its shape is M x N- I, is the indices matrix, its shape is M x K, K<=N
Is there a efficient way to get a Matrix R with the same shape of I so that R[x,y] = D[x, I[x,y]] ?
A nested for-loop or list-comprehension is too slow for me.
ZHUO QL (KDr2) http://kdr2.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion