# eigen_dec

Eigen decomposition of state-space model (either discrete or continuous time) defined by the A,B,C matrices. Eigen-states are organised in decreasing damping order or increased frequency order such that the truncation

`A[:N,:N], B[:N,:], C[:,:N]`

will retain the least N damped (or lower frequency) modes.

If the eigenvalues of A, eigs, are complex, the state-space is automatically convert into real by separating its real and imaginary part. This procedure retains the minimal number of states as only 2 equations are added for each pair of complex conj eigenvalues. Extra care is however required when truncating the system, so as to ensure that the chosen value of N does not retain the real part, but not the imaginary part, of a complex pair.

For this reason, the function also returns an optional output, `Nlist`

, such
that, for each N in Nlist, the truncation

A[:N,:N], B[:N,:], C[:,:N]

does guarantee that both the real and imaginary part of a complex conj pair
is included in the truncated model. Note that if ``order_by == None`

, the eigs
and UR must be given in input and must be such that complex pairs are stored
consecutively.

- param A:
state-space matrix

- param B:
state-space matrix

- param C:
matrices of state-space model

- param dlti:
specifies whether discrete (True) or continuous-time. This information is only required to order the eigenvalues in decreasing dmaping order

- param N:
number of states to retain. If None, all states are retained

- param eigs:
eigenvalues and right eigenvector of A matrix as given by: eigs,Ur=scipy.linalg.eig(A,b=None,left=False,right=True)

- param Ur:
eigenvalues and right eigenvector of A matrix as given by: eigs,Ur=scipy.linalg.eig(A,b=None,left=False,right=True)

- param Urinv:
inverse of Ur

- param order_by={‘damp’:
order according to increasing damping (damp)

- param ‘freq’:
order according to increasing damping (damp)

- param ‘stab’}:
order according to increasing damping (damp)

- param or decreasing frequency:
If None, the same order as eigs/UR is followed.

- type or decreasing frequency:
freq) or decreasing damping (stab

- param tol:
absolute tolerance used to identify complex conj pair of eigenvalues

- param complex:
if true, the system is left in complex form

Returns: (Aproj,Bproj,Cproj): state-space matrices projected over the first N (or N+1

if N removes the imaginary part equations of a complex conj pair of eigenvalues) related to the least damped modes

Nlist: list of acceptable truncation values