# ordeig

Eigenvalues of quasitriangular matrices

## Syntax

```E = ordeig(T) E = ordeig(AA,BB) ```

## Description

`E = ordeig(T)` takes a quasitriangular Schur matrix `T`, typically produced by `schur`, and returns the vector `E` of eigenvalues in their order of appearance down the diagonal of T.

`E = ordeig(AA,BB)` takes a quasitriangular matrix pair `AA` and `BB`, typically produced by `qz`, and returns the generalized eigenvalues in their order of appearance down the diagonal of `AA-λ*BB`.

`ordeig` is an order-preserving version of `eig` for use with `ordschur` and `ordqz`. It is also faster than `eig` for quasitriangular matrices.

## Examples

### Example 1

`T=diag([1 -1 3 -5 2]);`

`ordeig(T)` returns the eigenvalues of `T` 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```

## Version History

Introduced before R2006a