[SciPy-User] Operations with matrices

Ramon Crehuet rcsqtc at iqac.csic.es
Thu Jan 20 03:51:59 EST 2011


Hi Eat,
I do not see how bincount could help. It only accepts a 1D array as input, which 
is not the case, and the hard thing is to avoid the loop in indices on d.
Cheers,
Ramon

> Date: Wed, 19 Jan 2011 11:20:26 +0000 (UTC)
> From: eat<e.antero.tammi at gmail.com>
> Subject: Re: [SciPy-User] Operations with matrices
> To: scipy-user at scipy.org
> Message-ID:<loom.20110119T121844-849 at post.gmane.org>
> Content-Type: text/plain; charset=us-ascii
>
> 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
>>
>
>
>
>
>
> ------------------------------
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
> End of SciPy-User Digest, Vol 89, Issue 35
> ******************************************
>




More information about the SciPy-User mailing list