IMSL C Math Library
eig_herm (complex)

   more...
Computes the eigenexpansion of a complex Hermitian matrix A.
Synopsis
#include <imsl.h>
float *imsl_c_eig_herm (int n, f_complex *a, , 0)
The type double procedure is imsl_d_eig_herm.
Required Arguments
int n (Input)
Number of rows and columns in the matrix.
f_complex *a (Input)
Array of size n × n containing the matrix.
Return Value
A pointer to the n eigenvalues of the matrix. To release this space, use imsl_free. If no value can be computed, then NULL is returned.
Synopsis with Optional Arguments
#include <imsl.h>
float *imsl_c_eig_herm (int n, f_complex *a,
IMSL_VECTORS, f_complex **evec,
IMSL_VECTORS_USER, f_complex evecu[],
IMSL_RETURN_USER, float evalu[],
IMSL_RANGE, float elow, float ehigh,
IMSL_A_COL_DIM, int a_col_dim,
IMSL_EVECU_COL_DIM, int evecu_col_dim,
IMSL_RETURN_NUMBER, int *n_eval,
0)
Optional Arguments
IMSL_VECTORS, f_complex **evec (Output)
The address of a pointer to an array of size n × n containing eigenvectors of the matrix. On return, the necessary space is allocated by the function. Typically, f_complex *evec is declared, and &evec is used as an argument.
IMSL_VECTORS_USER, f_complex evecu[] (Output)
Compute eigenvectors of the matrix. An array of size n × n containing the unitary matrix of eigenvectors is returned in the space evecu.
IMSL_RETURN_USER, float evalu[] (Output)
Store the n eigenvalues in the space evalu.
IMSL_RANGE, float elow, float ehigh (Input)
Return eigenvalues and optionally eigenvectors that lie in the interval with lower limit elow and upper limit ehigh.
Default: (elowehigh) = (−∞, +).
IMSL_A_COL_DIM, int a_col_dim (Input)
The column dimension of A.
Default: a_col_dim = n
IMSL_EVECU_COL_DIM, int evecu_col_dim (Input)
The column dimension of X.
Default: evecu_col_dim = n
IMSL_RETURN_NUMBER, int *n_eval (Output)
The number of output eigenvalues and eigenvectors in the range elow, ehigh.
Description
The function imsl_c_eig_herm computes the eigenvalues of a complex Hermitian matrix by a two-phase process. The matrix is reduced to tridiagonal form by elementary orthogonal similarity transformations. Then, the eigenvalues are computed using a rational QR or bisection algorithm. Eigenvectors are calculated as required.
Example 1
 
#include <imsl.h>
 
int main()
{
int n = 3;
f_complex a[] = { {1,0}, {1,-7}, {0,-1},
{1,7}, {5,0}, {10,-3},
{0,1}, {10,3}, {-2,0} };
float *eval;
/* Compute eigenvalues */
eval = imsl_c_eig_herm(n, a, 0);
/* Print eigenvalues */
imsl_f_write_matrix ("Eigenvalues", 1, n, eval, 0);
}
Output
 
Eigenvalues
1 2 3
15.38 -10.63 -0.75
Example 2
This example is a variation of the first example. Here, the eigenvectors are computed as well as the eigenvalues.
 
#include <imsl.h>
 
int main()
{
int n = 3;
f_complex a[] = { {1,0}, {1,-7}, {0,-1},
{1,7}, {5,0}, {10,-3},
{0,1}, {10,3}, {-2,0} };
float *eval;
f_complex *evec;
/* Compute eigenvalues and eigenvectors */
eval = imsl_c_eig_herm(n, a,
IMSL_VECTORS, &evec,
0);
/* Print eigenvalues and eigenvectors */
imsl_f_write_matrix ("Eigenvalues", 1, n, eval, 0);
imsl_c_write_matrix ("Eigenvectors", n, n, evec, 0);
}
Output
 
Eigenvalues
1 2 3
15.38 -10.63 -0.75
 
Eigenvectors
1 2 3
1 ( 0.0631, -0.4075) ( -0.0598, -0.3117) ( 0.8539, 0.0000)
2 ( 0.7703, 0.0000) ( -0.5939, 0.1841) ( -0.0313, -0.1380)
3 ( 0.4668, 0.1366) ( 0.7160, 0.0000) ( 0.0808, -0.4942)
Warning Errors
IMSL_LOST_ORTHOGONALITY
The iteration for at least one eigenvector failed to converge. Some of the eigenvectors may be inaccurate.
IMSL_NEVAL_MXEVAL_MISMATCH
The determined number of eigenvalues in the interval (#, #) is #. However, the input value for the maximum number of eigenvalues in this interval is #.
Fatal Errors
IMSL_SLOW_CONVERGENCE_GEN
The iteration for the eigenvalues did not converge.
IMSL_HERMITIAN_DIAG_REAL
The matrix element A (#, #) = #. The diagonal of a Hermitian matrix must be real.