【发布时间】:2011-03-13 21:20:43
【问题描述】:
我试图找到矩阵的特征值乘以其转置,但我无法使用 numpy。
testmatrix = numpy.array([[1,2],[3,4],[5,6],[7,8]])
prod = testmatrix * testmatrix.T
print eig(prod)
我预计该产品会得到以下结果:
5 11 17 23
11 25 39 53
17 39 61 83
23 53 83 113
和特征值:
0.0000
0.0000
0.3929
203.6071
当将testmatrix 与其转置相乘时,我得到了ValueError: shape mismatch: objects cannot be broadcast to a single shape。
这在 MatLab 中有效(乘法,而不是代码),但我需要在 python 应用程序中使用它。
谁能告诉我我做错了什么?
【问题讨论】:
标签: python numpy scipy eigenvalue