[Numpy-discussion] BLAS

Alexander Schmolck a.schmolck at gmx.net
Thu Feb 20 17:22:18 EST 2003


R.M.Everson at exeter.ac.uk (R.M.Everson) writes:

> Hi,
> 
> As Paul Dubois says, some Numeric functions can be configured to use the
> BLAS library.  However, the BLAS is not used for, perhaps the most common
> and important operation: matrix/vector multiplication.
> 
> We have written a small patch to interface to replace the
> matrixproduct/dot/innerproduct functions in multiarraymodule.c with the
> appropriate BLAS calls.
> 
> The patch (against Numeric 21.1b) can be found at
> http://www.dcs.ex.ac.uk/~aschmolc/Numeric and can give a speed up of a
> factor of 40 on 1000 by 1000 matrices using the Atlas BLAS.  More details
> of the (naive!) timings can be found there too.
> 

An addendum: the new version is no longer a patch against Numeric, but a
separate module, currently called 'dotblas', which is a cleaner approach as it
doesn't require using a modified version of Numeric. To use this fast dot
instaed of Numeric's dot, you can e.g do:

import Numeric
# no errors if dotblas isn't installed
try:
   import dotblas
   Numeric.dot = dotblas.dot
except ImportError: pass

I just put a prerelease (which still handles complex arrays DIFFERENTLY from
Numeric!!!) online at:

 http://www.dcs.ex.ac.uk/~aschmolc/Numeric/dotblas.html

enjoy,

alex





More information about the NumPy-Discussion mailing list