import numpy as np
from numpy import linalg as LA
a = np.array([[1, 1j], [-1j, 1]])
w, v = LA.eig(a)
# w are the eigenvalues, v are the eigenvectors
# v.real gives the real-valued parts of the eigenvectors
# v == v.real gives a boolean mask for where the vector equals its own real part
real_eigenvectors = v[v.real == v]
别紧张。在
在the docs的帮助下:
使用^{} 或{a2}。这些函数是为对称(或Hermitian)矩阵设计的,对于实对称矩阵,它们应该始终返回实特征值和特征向量。在
例如
特征值在
^{pr2}$vals
中,相应的特征向量在vecs
的列中:相关问题 更多 >
编程相关推荐