[SciPy-User] Operations with matrices

Ramon Crehuet rcsqtc at iqac.csic.es
Wed Jan 19 06:00:52 EST 2011


Ooops!
It is not like this!

On 19/01/11 11:50, Ramon Crehuet wrote:
> c = zeros(n)
> for (i,j) in d:
>     k = d[i,j]
>     c[k] += r[i,j] 
it should be like:
c = zeros(n)
for position, value in ndenumerate(d):
     c[value] += r[position]

This is simpler, but probably still too slow...
Thanks again!
Ramon




More information about the SciPy-User mailing list