[SciPy-User] A newbie question on matrix multiplication

Graziano Mirata graziano.mirata at lu.unisi.ch
Thu Mar 25 09:29:18 EDT 2010


	Hi to everybody, 
i am new here and above all I am new in python. After years of matlab programming I finally have switched to Python. 

Coming to question: i am trying to multiply a matrix transpose by itself but i've got an error on the shape. But it is impossible. Here there is the code: 

type(f) 
Out[213]: <type 'numpy.ndarray'> 

In [214]: type(ft) 
Out[214]: <type 'numpy.ndarray'> 

In [215]: f.size 
Out[215]: 12 

In [216]: f.shape 
Out[216]: (4, 3) 

In [217]: ft = f.transpose() 

In [218]: ft.shape 
Out[218]: (3, 4) 

In [219]: ft*f 
--------------------------------------------------------------------------- 
ValueError                                Traceback (most recent call last) 

/Users/Graz/Documents/PhD researchs/Outsample Perf KT/PythonCodesOSPKT/<ipython console> in <module>() 

ValueError: shape mismatch: objects cannot be broadcast to a single shape 


Any idea where i am wrong? 

Thanx 

G 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20100325/e57e8345/attachment.html>


More information about the SciPy-User mailing list