[英]Matrix multiplication renders different results when converting from MATLAB to python
I have an MxN
matrix A
where A
is complex and apparently has some properties which renders a diagonal matrix for A'*A
. 我有一个
MxN
矩阵A
,其中A
是复数,并且显然具有一些属性,从而为A'*A
呈现对角矩阵。 A
is also very large (256x16384) so I cannot think of a way to upload it here for reproducing. A
也非常大(256x16384),所以我想不出一种将其上传到此处进行复制的方法。
In the MATLAB code, I have: 在MATLAB代码中,我有:
imshow(abs(A'*A),[]);
this produces the following image: 这将产生以下图像:
The converted code in python: 在python中转换的代码:
tmp=np.dot(A.T,A)
plt.imshow(np.absolute(tmp))
plt.show()
produces: 产生:
The diagonal seemed to rotate. 对角线似乎在旋转。 Is there any reason for this rotation?
轮换有什么原因吗? Am I doing the conversion correctly?
我转换正确吗?
I guess that you're confusing between the transpose and the conjugate transpose operator. 我猜您在转置和共轭转置运算符之间感到困惑。
Matlab to Python: Matlab到Python:
A.'
A.'
AT
AT
A'
A'
A.conj().T
A.conj().T
So change your matlab code or your python code according to your need. 因此,根据需要更改您的matlab代码或python代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.