[SciPy-user] dgemm overwrite_c bug?

Dan Goodman dg.numpy at thesamovar.net
Wed Aug 27 22:03:45 EDT 2008


Hi all,

I'm interesting in doing a matrix multiplication in-place, and because
numpy's dot function doesn't do that I had to go looking. After much pain
I finally found the linalg.blas etc. stuff in scipy. However, I think that
the dgemm function is ignoring the overwrite_c parameter, e.g.:

from numpy import array
from scipy import linalg
gemm, = linalg.blas.get_blas_funcs(['gemm'])
x=array([[1.,2.],[3.,4.]])
y=array([[5.,6.],[7.,8.]])
c=array([[8.,9.],[10.,11.]])
print gemm(1.0,x,y,1.,c,0,0,overwrite_c=1)
print
print c

gives the output

[[ 27.  31.]
 [ 53.  61.]]

[[  8.   9.]
 [ 10.  11.]]

but the two matrices ought to be the same...

Or have I misunderstood something? There seems to be a lack of documentation
for these functions, so that's quite possible.

Is there any way of getting access to an in-place matrix multiplication
like this?

Many thanks,
Dan Goodman




More information about the SciPy-User mailing list