Matrice Multiplication Problem

Robert Kern robert.kern at gmail.com
Thu Aug 24 13:02:26 EDT 2006


mclaugb wrote:
> I want to multiply two arrays:  a matrice and the conjugate of its 
> transpose.  Then i wish to invert the resulting matrix.

You will want to ask numpy questions on the numpy mailing list.

   http://www.scipy.org/Mailing_Lists

> In Matlab, the statement is :  Z= inv(M .' * M)
> 
> To implement in python, I simply cannot get this to work.  Here is my code:
> 
> from numpy import *
> import scipy as Sci
> from scipy.linalg import lu
> m=array([[4,6+7j],[3+3j,7],[2+2j,4-7j]])
> z=m.conj().transpose()
> q=z*m

numpy arrays are not matrices. * performs elementwise multiplication. Use 
numpy.dot(z, m).

-- 
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