[Numpy-discussion] matrix multiplication A x, x has some zeros
dmitrey
dmitrey.kroshko@scipy....
Fri Dec 14 14:29:59 CST 2007
Thank you for the tip, however, I expect <A,x> being vector of length n
A and x change every iter. A is not sparse.
Alan G Isaac wrote:
> On Fri, 14 Dec 2007, dmitrey apparently wrote:
>
>> I guess it doesn't matter, but typical n are 1...1000.
>> However, I need to call the operation hundreds or thousands times (while
>> running NLP solver ralg, so 4..5 * nIter times).
>> Number of zeros can be 0...n-1
>>
>
> Do both A and x change every iteration?
>
> Anyway, if x is sparse I think you'll get some
> benefit by doing
> idx=N.ravel(x)!=0
> A[:,idx]*x[idx]
>
> hth,
> Alan Isaac
>
>
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
>
>
More information about the Numpy-discussion
mailing list