[SciPy-user] efficient linear algebra

Darren Dale dd55 at cornell.edu
Sat Mar 12 21:07:40 EST 2005


Hi,

I have a simulation that has to repeatedly find the dot product of a 250,000x3 array 
with a 3x1 array. I have a working atlas 3.6.0, and believe scipy to be properly 
installed, all the tests pass, etc.

I read (http://www.scipy.org/mailinglists/mailman?fn=scipy-user/2004-June/002902.html) 
that scipy.dot may not be the fastest solution, so I tried

dot, = scipy.linalg.blas.get_blas_funcs(['gemm'],(ones([250000,3],'d'),ones((3,1),'d')))

and 

dot, = scipy.linalg.blas.get_blas_funcs(['dot'],(ones([250000,3],'d'),ones((3,1),'d')))

When I tested how long each takes, scipy.dot took .1 seconds, the blas gemm took 0.13 
seconds, and the blas dot gave me the following error:

error: (len(y)-offy>(n-1)*abs(incy)) failed for 1st keyword n

If I dot an Nx3 with a 3x1, I get the above error. If I dot a 1x3 with a 3xN, I do not get 
the error. Is this a bug?

Is my approach correct? Should I expect much of a performance boost from using the 
function returned by get_blas_funcs, and if so, are there suggestions as to why I might
be taking a performance hit? Where can I learn more about using the blas routines 
intelligently?

Thank you,

Darren




More information about the SciPy-User mailing list