numpy.linalg.eig如何决定返回特征值的顺序?

时间:2015-05-22 00:13:56

标签: python numpy linear-algebra eigenvalue

当我使用numpy.linalg.eig

eValues, eVectors = numpy.linalg.eig(someMatrix)

返回的eValues几乎是降序排列。

numpy.linalg.eig如何决定返回特征值的顺序?

1 个答案:

答案 0 :(得分:3)

Numpy不保证 -

来自docstring

Returns
-------
w : (..., M) array
    The eigenvalues, each repeated according to its multiplicity.
    The eigenvalues are not necessarily ordered. The resulting
    array will be always be of complex type. When `a` is real
    the resulting eigenvalues will be real (0 imaginary part) or
    occur in conjugate pairs

Numpy委托LAPACK进行此计算,因此如果存在任何一致的排序,您应该考虑它的实现细节而不是依赖它。