简体   繁体   English

在np.linalg.eig中以什么顺序重复的本征值?

[英]In which order eigen values repeated in np.linalg.eig?

Documentation says that eigenvalues are repeated according to its multiplicity and the are not ordered. 文档说,特征值根据其多重性重复,并且不排序。 When I print w it gives me [5,3,5,1]. 当我打印w时,它会给我[5,3,5,1]。 Why eigenvalues appear in this order. 为什么特征值按此顺序出现。 What is the storing order for eigen vectors? 特征向量的存储顺序是什么? Is it same as for eigenvalues? 与特征值相同吗?

B = np.array([[5,-2,6,-1],[0,3,-8,0],[0,0,5,4],[0,0,0,1]])
print(B)
print(B.shape)
w, v= np.linalg.eig(B)
print("eigenvalues are: ", w)

Yes the eigenvectors will be in the same order, you can verify this by adding just two lines to your code 是的,特征向量的顺序相同,您可以通过在代码中仅添加两行来验证这一点

import numpy as np
B=np.array([[5,-2,6,-1],[0,3,-8,0],[0,0,5,4],[0,0,0,1]])
print(B)
print(B.shape)
w,v= np.linalg.eig(B)
print("eigenvalues are: ", w)

for i in range(4):
    print (np.dot((B-w[i]*np.eye(4)),v[:,i]))

As far as the concept of multiplicity is concerned, a single eigenvalue can be associated with multiple linearly independent eigenvectors. 就多重性的概念而言,单个特征值可以与多个线性独立的特征向量相关联。 You can read more about this here 您可以在此处了解更多信息

The documentation provides the following information regarding the eigenvectors. 文档提供了有关特征向量的以下信息。

The normalized (unit “length”) eigenvectors, such that the column v[:,i] is the eigenvector corresponding to the eigenvalue w[i]. 归一化的(单位“长度”)特征向量,使得列v [:,i]是对应于特征值w [i]的特征向量。

In other words, the order of eigenvalues is arbitrary in principle. 换句话说,特征值的顺序原则上是任意的。 But whatever order of the eigenvalues, the order will match the eigenvectors. 但是,无论特征值的顺序如何,该顺序都将与特征向量匹配。

You can verify that the eigenvalues and eigenvector orders match by computing the application of B to the column vectors of v . 您可以通过计算Bv的列向量的应用来验证特征值和特征向量顺序是否匹配。 In code, 在代码中

for i in range(B.shape[0]):
    # Apply B to the eigenvectors
    scaled = np.dot(B, v[:, i])
    # Check that applying B only applies a scaling to the eigenvector
    np.testing.assert_allclose(scaled, w[i] * v[:, i])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 np.linalg.eig 中的错误特征值 - wrong eigenvalues in np.linalg.eig NumPy:为什么np.linalg.eig和np.linalg.svd给出不同的SVD V值? - NumPy: why does np.linalg.eig and np.linalg.svd give different V values of SVD? np.linalg.eig() 需要很长时间才能运行 - np.linalg.eig() taking a lot time to run np.linalg.eig 为同一矩阵给出不同的特征向量 - np.linalg.eig gives different eigenvectors for the same matrix 使用这个命令`np.linalg.eig(H * H)`来计算特征分解是一种合适的方法吗? - is it an appropriate way to compute eigendecomposition by using this command `np.linalg.eig(H*H)`? 当我尝试对对称矩阵进行对角化时,为什么“np.linalg.eig”不返回酉矩阵? - Why isn't `np.linalg.eig` returning a unitary matrix when I try to diagonalize a symmetric matrix? 试图从 numpy linalg eig 返回与 matlab eig 相同的特征值和向量结果 - trying to return same eigen values and vectors results from numpy linalg eig as matlab eig does 如何使用np.linalg.eigh(A)打印所有本征值? - How to print all the eigen values using np.linalg.eigh(A)? numpy.linalg.eig如何决定返回特征值的顺序? - How does numpy.linalg.eig decide on order in which eigenvalues are returned? 为什么numpy.linalg.eig不满足“矩阵点特征向量=特征值点特征向量”? - Why does numpy.linalg.eig not satisfy "matrix dot eigen vector = eigen value dot eigen vector"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM