[Numpy-discussion] Efficient ?axpy operation without copy (B += a*A)

Michael McNeil Forbes mforbes at physics.ubc.ca
Tue Jun 23 14:19:48 EDT 2009


Is there a way of performing vectorized ?axpy (daxpy) operations  
without making copies or dropping into C?

i.e: I want to do

big = (10000,5000)
A = np.ones(big,dtype=float)
B = np.ones(big,dtype=float)
a = 1.5
B += a*A

without making any copies?

(I know I could go

A *= a
B += A
A /= a

but that is not so efficient either).

There are exposed blas daxpy operations in scipy, but in the version I  
have (EPD), these also seem to make copies (though recent version seem  
to be fixed by looking at the source.)


More information about the NumPy-Discussion mailing list