[Numpy-discussion] Help w/ indexing, please

David Goldsmith d.l.goldsmith@gmail....
Tue Jul 27 11:10:23 CDT 2010


Hi!  I have a large M x K, M, K ~ 1e3 array L of indices - non-negative
integers in the range 0 to N-1 - and an N x 3 array C (a matplotlib
colormap).  I need to create an M x K x 3 array R such that R[m,k,j] =
C[L[m,k], j], j = 0,1,2.  I want to do so w/out having to loop through all
the (m,k) index pairs, but I'm having trouble wrapping my brain around how
to do it - please help.  Thanks.

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100727/0dc7570e/attachment.html 


More information about the NumPy-Discussion mailing list