M
mclaugb
I want to multiply two arrays: a matrice and the conjugate of its
transpose. Then i wish to invert the resulting matrix.
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
Traceback (most recent call last):
File "C:\Program Files\ActiveState Komodo
3.5\lib\support\dbgp\pythonlib\dbgp\client.py", line 3241, in runcode
locals = self.frame.f_locals)
File "C:\Program Files\ActiveState Komodo
3.5\lib\support\dbgp\pythonlib\dbgp\client.py", line 1583, in runcode
h_exec(code, globals=globals, locals=locals, module=module)
File "C:\Program Files\ActiveState Komodo
3.5\lib\support\dbgp\pythonlib\dbgp\client.py", line 520, in __init__
exec code in globals, locals
File "<console>", line 0, in __main__
ValueError: index objects are not broadcastable to a single shape
transpose. Then i wish to invert the resulting matrix.
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
Traceback (most recent call last):
File "C:\Program Files\ActiveState Komodo
3.5\lib\support\dbgp\pythonlib\dbgp\client.py", line 3241, in runcode
locals = self.frame.f_locals)
File "C:\Program Files\ActiveState Komodo
3.5\lib\support\dbgp\pythonlib\dbgp\client.py", line 1583, in runcode
h_exec(code, globals=globals, locals=locals, module=module)
File "C:\Program Files\ActiveState Komodo
3.5\lib\support\dbgp\pythonlib\dbgp\client.py", line 520, in __init__
exec code in globals, locals
File "<console>", line 0, in __main__
ValueError: index objects are not broadcastable to a single shape