[Numpy-discussion] matrix multiplication A x, x has some zeros
Alan G Isaac
aisaac@american....
Fri Dec 14 07:28:47 CST 2007
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
More information about the Numpy-discussion
mailing list