[SciPy-User] Operations with matrices

eat e.antero.tammi at gmail.com
Wed Jan 19 06:20:26 EST 2011


Ramon Crehuet <rcsqtc <at> iqac.csic.es> writes:

Hi
> 
> 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]
Have you checked bincount?

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







More information about the SciPy-User mailing list