[Numpy-discussion] performance matrix multiplication vs. matlab

David Paul Reichert D.P.Reichert at sms.ed.ac.uk
Thu Jun 4 09:36:38 EDT 2009

Hi all,

I would be glad if someone could help me with
the following issue:

 From what I've read on the web it appears to me
that numpy should be about as fast as matlab. However,
when I do simple matrix multiplication, it consistently
appears to be about 5 times slower. I tested this using

A = 0.9 * numpy.matlib.ones((500,100))
B = 0.8 * numpy.matlib.ones((500,100))

def test():
     for i in range(1000):

I also used ten times larger matrices with ten times less
iterations, used xrange instead of range, arrays instead
of matrices, and tested it on two different machines,
and the result always seems to be the same.

Any idea what could go wrong? I'm using ipython and
matlab R2008b.



The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

More information about the NumPy-Discussion mailing list