Eigensystems

Header file eigensys.h

Eigenvalues and eigenvectors of symmetric tridiagonal matrix

Uses iterative QL algorithm with implicit shifts. Algorithm based on Reinsch. The eigenvector matrix is ignored if eigenvectors are not required. If fail because reach max iterations, returns 0 (otherwise 1).
int evecsymmtridiagql(
   // Data in:
   const int n, // order of original matrix
   Vector& s, // n-1 subdiagonal elements (n long; corrupted in working)
   // Data in/out:
   Vector& dev, // n diagonal elements in, n eigenvalues out
   // Data out:
   Matrix& q, // eigenvectors (if requested)
   // Control data:
   const int do_evec, // true if eigenvalues are required
   const double eps = 1.0e-6, // bandwidth for zeroing off-diagonal elements
   const int maxits = 0 // maximum iterations (0 for no limit)
)

Reduce a symmetric matrix A to tridiagonal form

Uses Householder transformations A' = QAQ to zero successive columns. Keeps a track of product of Qs if required for calculating eigenvectors. The transformation matrix is not used unless requested. If it is requested, it should be initialised to the identity matrix or previous transformations of A, e.g. balancing.
void symmtridiagh(
   // Data in/out:
   Matrix& a, // symmetric square matrix in, symmetric tridiagonal matrix out
   // Data out:
   Matrix& q, // orthogonal transformation making A tridiagonal
   // Control data:
   const int track, // 1 if transformation is to be recorded
   const double eps = 1.0e-6 // bandwidth for zeroing off-diagonal elements
)

Eigenvalues and eigenvectors of a symmetric matrix

Converts symmetric matrix to tridiagonal with Householder transformations, then uses iterative QL algorithm to find eigenvalues and eigenvectors. If eigenvectors are not requested, the matrix Q is not used. If fail because reach max iterations, returns 0 (otherwise 1). Original matrix is corrupted in the solution.
int evecsymmhql_corrupts(
   // Data in:
   Matrix& a, // symmetric square square matrix (corrupted)
   // Data out:
   Vector& ev, // eigenvalues
   Matrix& q, // eigenvectors (if requested)
   // Control data:
   const int do_evec, // true if eigenvalues are required
   const double eps = 1.0e-6, // bandwidth for zeroing off-diagonal elements
   const int maxits = 0 // maximum iterations (0 for no limit)
)

Eigenvalues and eigenvectors of a symmetric matrix

Converts symmetric matrix to tridiagonal with Householder transformations, then uses iterative QL algorithm to find eigenvalues and eigenvectors. If eigenvectors are not requested, the matrix Q is not used. If fail because reach max iterations, returns 0 (otherwise 1).
int evecsymmhql(
   // Data in:
   const Matrix& a, // symmetric square square matrix
   // Data out:
   Vector& ev, // eigenvalues
   Matrix& q, // eigenvectors (if requested)
   // Control data:
   const int do_evec, // true if eigenvalues are required
   const double eps = 1.0e-6, // bandwidth for zeroing off-diagonal elements
   const int maxits = 0 // maximum iterations (0 for no limit)
)