如何找出对应于矩阵特定特征值的特征向量? [英] How do I find out eigenvectors corresponding to a particular eigenvalue of a matrix?
问题描述
如何找出与特定特征值相对应的特征向量?
How do I find out eigenvectors corresponding to a particular eigenvalue?
我有一个随机矩阵(P),其特征值之一是1.我需要找到对应于特征值1的特征向量.
I have a stochastic matrix(P), one of the eigenvalues of which is 1. I need to find the eigenvector corresponding to the eigenvalue 1.
scipy函数 scipy.linalg. eig 返回特征值和特征向量的数组.
The scipy function scipy.linalg.eig returns the array of eigenvalues and eigenvectors.
D, V = scipy.linalg.eig(P)
这里D(值的数组)和V(向量的数组)都是向量.
Here D(array of values) and V(array of vectors) are both vectors.
一种方法是在D中进行搜索,然后在V中提取相应的特征向量.有没有更简单的方法?
One way is to do a search in D and extract the corresponding eigenvector in V. Is there an easier way?
推荐答案
If you are looking for one eigenvector corresponding to one eigenvalue, it could be much more efficient to use the scipy.sparse.linalg implementation of the eig function. It allows to look for a fixed number of eigenvectors and to shift the search around a specific value. You could do for instance :
values, vectors = scipy.sparse.linalg.eigs(P, k=1, sigma=1)
这篇关于如何找出对应于矩阵特定特征值的特征向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!