Reputation: 5095
When I use numpy.linalg.eig
like
eValues, eVectors = numpy.linalg.eig(someMatrix)
the eValues returned are almost in descending order.
How does numpy.linalg.eig decide on order in which eigenvalues are returned?
Upvotes: 4
Views: 1398
Reputation: 363183
Numpy makes no guarantees about that -
from the 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 delegates to LAPACK for this computation, so if there is any consistent ordering you should consider it implementation detail and not rely on it.
Upvotes: 3