numpy array, strangeness
Alex Martelli
aleax at aleax.it
Thu Feb 27 15:58:31 EST 2003
Stephane Jolicoeur wrote:
> Hello,
> I am trying to work with LinearAlgebra.py, it works but Numpy won't let
> me do the reverse equation.
> I have an array q that is 12 by 9 then use LinearAlgebra's
> singular_value_decomposition on it and get back 3 arrays T , S and D.
> Now q should be the product of T*S*D, so I do this in the shell and get
Whoa! In Numeric, T*S*D means *ELEMENT-WISE* multiplication of
the three arrays T, S, and D -- and their shapes are such that
such element-wise multiplication fails (and if it succeeded you
would not be happy about it!!!).
What you need is MATRIX multiplication, which in Numeric is
performed by function Numeric.matrixmultiply, also known as
Numeric.dot.
Alex
More information about the Python-list
mailing list