Faster way to map numpy arrays

Saurabh Kabra skabra at gmail.com
Sun Jun 24 23:37:59 EDT 2012


I have written a script to map a 2D numpy array(A) onto another array(B) of
different dimension. more than one element (of array A) are summed and
mapped to each element of array B.  To achieve this I create a list where I
store the index of array A to be mapped to array B. The list is the
dimension of array B (if one can technically say that) and each element is
a list of indices to be summed. Then I parse this list with a nested loop
and compute each element of array B.

Because of the nested loop and the big arrays the process takes a minute or
so. My question is: is there a more elegant and significantly faster way of
doing this in python?

Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120625/477b5053/attachment.html>


More information about the Python-list mailing list