# eigsort

Version:

Computes eigenvalues and eigenvectors for real or complex square matrices. eigsort(a) solves the standard problem a x = lambda*x. eigsort(a,b) solves the general problem a x = lambda*b x. Out of all possible eigenvalues and eigenvectors, MathScript returns only six according to the order you specify.

## Syntax

ev = eigsort(a)
ev = eigsort(a, k)
ev = eigsort(a, k, order)
ev = eigsort(a, b)
ev = eigsort(a, b, k)
ev = eigsort(a, b, k, order)
[evec, evdiag] = eigsort(a)
[evec, evdiag] = eigsort(a, k)
[evec, evdiag] = eigsort(a, k, order)
[evec, evdiag] = eigsort(a, b)
[evec, evdiag] = eigsort(a, b, k)
[evec, evdiag] = eigsort(a, b, k, order)
Legacy name: eigs

## a

Square matrix whose dependent matrices are also square.

## k

Number of eigenvalues to be calculated.

Default: 6

## b

Matrix of the same size as a.

## order

Determines, which eigenvalues and eigenvectors to compute. order is a string that accepts the following values.

Name Description
'LM' (default)

Sorts the eigenvalues by magnitude from largest to smallest.

'SM'

Sorts the eigenvalues by magnitude from smallest to largest.

'LR'

Sorts the eigenvalues by real part from largest to smallest.

'SR'

Sorts the eigenvalues by real part from smallest to largest.

'LI'

Sorts the eigenvalues by imaginary part from largest to smallest.

'SI'

Sorts the eigenvalues by imaginary part from smallest to largest.

## ev

Six eigenvalues of a or the generalized eigenvalues of a and b. ev is a vector.

## evec

Matrix of six columns whose columns are the normalized eigenvectors of a or the normalized generalized eigenvectors of a and b.

## evdiag

6-by-6 matrix with the elements of ev on the diagonal.

## Repeated Roots

MathScript does not solve the off-diagonal Jordan structure associated with repeated roots. If repeated roots to eig(a) or eig(a, b) exist, MathScript might ill-condition evec artificially.

A = rand(100);
C = eigsort(A)

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported