Best form when using matrices and arrays in scipy...

2006-05-10 Thread conor . robinson

Using large arrays of data I found it is MUCH faster to cast arrays to
matricies and then multiply the two matricies togther
(scipy.matrix(ARRAY1)*scipy.matrix(ARRAY2)) in order to do a matrix
multipy of two arrays vs. scipy.matrixmultipy(ARRAY1, ARRAY2).

Are there any logical/efficiency errors with this train of thought and
is there a valid reason for the speed increase?

Thanks,
Conor

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best form when using matrices and arrays in scipy...

2006-05-10 Thread Robert Kern
[EMAIL PROTECTED] wrote:
 Using large arrays of data I found it is MUCH faster to cast arrays to
 matricies and then multiply the two matricies togther
 (scipy.matrix(ARRAY1)*scipy.matrix(ARRAY2)) in order to do a matrix
 multipy of two arrays vs. scipy.matrixmultipy(ARRAY1, ARRAY2).
 
 Are there any logical/efficiency errors with this train of thought and
 is there a valid reason for the speed increase?

matrixmultiply is a backwards-compatibility alias. You should be using dot()
instead. When an optimized BLAS is available dot() is replaced with an optimized
version. numpy.matrix uses dot() to implement its multiplication operation.
Unfortunately, the code that does the replacement does not seem to handle
matrixmultiply correctly.

Also, there are better fora for asking questions about numpy and scipy:

  http://www.scipy.org/Mailing_Lists

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list