eig_sym

   more...
Computes the eigenexpansion of a real symmetric matrix A.
Synopsis
#include <imsl.h>
float *imsl_f_eig_sym (int n, float *a, , 0)
The type double procedure is imsl_d_eig_sym.
Required Arguments
int n (Input)
Number of rows and columns in the matrix.
float *a (Input)
Array of size n × n containing the symmetric matrix.
Return Value
A pointer to the computed eigenvalues of the symmetric 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_f_eig_sym (int n, float *a,
IMSL_VECTORS, float **evec,
IMSL_VECTORS_USER, float 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, float **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, float *evec is declared, and &evec is used as an argument.
IMSL_VECTORS_USER, float 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_f_eig_sym computes the eigenvalues of a symmetric real 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 (Parlett 1980, pp. 169 - 173).
Examples
Example 1
 
#include <imsl.h>
 
int main()
{
int n = 3;
float a[] = {7.0, -8.0, -8.0,
-8.0, -16.0, -18.0,
-8.0, -18.0, 13.0};
float *eval;
/* Compute eigenvalues */
eval = imsl_f_eig_sym(n, a, 0);
/* Print eigenvalues */
imsl_f_write_matrix ("Eigenvalues", 1, 3, eval, 0);
}
Output
 
Eigenvalues
1 2 3
-27.90 22.68 9.22
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;
float a[] = {7.0, -8.0, -8.0,
-8.0, -16.0, -18.0,
-8.0, -18.0, 13.0};
float *eval;
float *evec;
/* Compute eigenvalues and eigenvectors */
eval = imsl_f_eig_sym(n, a,
IMSL_VECTORS, &evec,
0);
/* Print eigenvalues and eigenvectors */
imsl_f_write_matrix ("Eigenvalues", 1, n, eval, 0);
imsl_f_write_matrix ("Eigenvectors", n, n, evec, 0);
}
Output
 
Eigenvalues
1 2 3
-27.90 22.68 9.22
 
Eigenvectors
1 2 3
1 0.2945 -0.2722 0.9161
2 0.8521 -0.3591 -0.3806
3 0.4326 0.8927 0.1262
Warning Errors
IMSL_SLOW_CONVERGENCE_SYM
The iteration for the eigenvalue failed to converge in 100 iterations before deflating.
IMSL_SLOW_CONVERGENCE_2
Inverse iteration did not converge. Eigenvector is not correct for the specified eigenvalue.
IMSL_LOST_ORTHOGONALITY
The iteration for at least one eigenvector failed to converge. Some of the eigenvectors may be inaccurate.
IMSL_LOST_ORTHOGONALITY_2
The eigenvectors have lost orthogonality.
IMSL_NO_EIGENVALUES_RETURNED
The number of eigenvalues in the specified interval exceeds mxeval. The argument n_eval contains the number of eigenvalues in the interval. No eigenvalues will be returned.