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 d_complex function is imsl_z_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 eigenvalues of the matrix in decreasing order of magnitude. 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_EXTREME_VALUES, int small, int n_extreme,

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_eval containing the orthonormal eigenvectors of the matrix. In the special case of n_eval = 0, a one-element array is returned. 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. Array evecu, which contains the orthonormal eigenvectors, is user-defined and must be of size n × k, where k >= n_extreme if optional argument IMSL_EXTREME_VALUES is used, and k >= n otherwise.

IMSL_RETURN_USER, float evalu[] (Output)
Store the eigenvalues in decreasing order of magnitude in a user-defined array. Array evalu must be of size k, where k >= n_extreme if optional argument IMSL_EXTREME_VALUES is used, and k >= n otherwise.

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_EXTREME_VALUES, int small, int n_extreme (Input)
Return extreme eigenvalues and optionally eigenvectors of the matrix. If small = 0, the largest n_extreme eigenvalues are returned, if small = 1, the smallest n_extreme eigenvalues are returned.

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 evecu.
Default: evecu_col_dim = n_extreme, if argument IMSL_EXTREME_VALUES is used, evecu_col_dim = n otherwise.

IMSL_RETURN_NUMBER, int *n_eval (Output)
The number of output eigenvalues and eigenvectors in the range (elow, ehigh) or, if optional argument IMSL_EXTREME_VALUES is used, the number of extreme eigenvalues computed (that is, n_extreme).

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.

Examples

 

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 #.

IMSL_HERMITIAN_DIAG_REAL_1

The matrix element “a[#][#]” =#. The diagonal of a Hermitian matrix must be real; its imaginary part is set to zero.

IMSL_BEST_ESTIMATE_RETURNED

The iteration for an eigenvalue failed to converge. The best estimate will be returned.

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.