Best form when using matrices and arrays in scipy...
Robert Kern
robert.kern at gmail.com
Wed May 10 19:55:40 EDT 2006
conor.robinson at gmail.com 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
More information about the Python-list
mailing list