ordeig
Eigenvalues of quasitriangular matrices
Syntax
E = ordeig(T)
E = ordeig(AA,BB)
Description
E = ordeig(T)
takes a quasitriangular Schur matrixT
, typically produced byschur
, and returns the vectorE
of eigenvalues in their order of appearance down the diagonal of T.
E = ordeig(AA,BB)
takes a quasitriangular matrix pairAA
andBB
, typically produced byqz
, and returns the generalized eigenvalues in their order of appearance down the diagonal ofAA-λ*BB
.
ordeig
is an order-preserving version ofeig
for use withordschur
andordqz
. It is also faster thaneig
for quasitriangular matrices.
Examples
Example 1
T=diag([1 -1 3 -5 2]);
ordeig(T)
returns the eigenvalues ofT
in the same order they appear on the diagonal.
ordeig(T) ans = 1 -1 3 -5 2
eig(T)
, on the other hand, returns the eigenvalues in order of increasing magnitude.
eig(T) ans = -5 -1 1 2 3
Example 2
A = rand(10); [U, T] = schur(A); abs(ordeig(T)) ans = 5.3786 0.7564 0.7564 0.7802 0.7080 0.7080 0.5855 0.5855 0.1445 0.0812 % Move eigenvalues with magnitude < 0.5 to the % upper-left corner of T. [U,T] = ordschur(U,T,abs(E)<0.5); abs(ordeig(T)) ans = 0.1445 0.0812 5.3786 0.7564 0.7564 0.7802 0.7080 0.7080 0.5855 0.5855