[Numpy-discussion] Inplace dot and blas access

Dan Goodman dg.numpy@thesamovar....
Mon Aug 25 12:51:31 CDT 2008

Hi all,

I'm sorry for what is probably a very simple question but despite looking I
didn't manage to find anything.

I have some code (solving linear differential equation) which is doing the
following operation lots of times:

S[:] = dot(A,S)+C

here S is a (M,N) matrix, A is (M,M) and C is (M,1). M is usually smallish and N
is largish.

My question is, can this be turned into an inplace operation to save memory and

As far as I can see, although some array functions allow you to specify the
destination of the output, dot always generates a new array. So I would like to
have something like this:

dot(A,S, out=S)

Ideally, I could do this in one line. I believe the BLAS DGEMM routine does what
I want (if I converted C to a matrix rather than a vector). Is there any way to
access this using Python and NumPy (e.g. something like numpy.blas.DGEMM) or
would I need to use C code to do this?

Many thanks in advance,
Dan Goodman

More information about the Numpy-discussion mailing list