IMSL C Math Library
eig_symgen

   more...
Computes the generalized eigenexpansion of a system Ax = λBx. The matrices A and B are real and symmetric, and B is positive definite.
Synopsis
#include <imsl.h>
float *imsl_f_eig_symgen (int n, float *a, float *b, , 0)
The type double procedure is imsl_d_eig_symgen.
Required Arguments
int n (Input)
Number of rows and columns in the matrices.
float *a (Input)
Array of size n  ×n containing the symmetric coefficient matrix A.
float *b (Input)
Array of size n  ×n containing the positive definite symmetric coefficient matrix B.
Return Value
A pointer to the n eigenvalues of the symmetric 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_f_eig_symgen (int n, float *a, float *b,
IMSL_VECTORS, float **evec,
IMSL_VECTORS_USER, float evecu[],
IMSL_RETURN_USER, float evalu[],
IMSL_A_COL_DIM, int a_col_dim,
IMSL_B_COL_DIM, int b_col_dim,
IMSL_EVECU_COL_DIM, int evecu_col_dim,
0)
Optional Arguments
IMSL_VECTORS, float **evec (Output)
The address of a pointer to an array of size n  ×n containing eigenvectors of the problem. 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. An array of size n  ×n containing the matrix of generalized eigenvectors is returned in the space evecu.
IMSL_RETURN_USER, float evalu[] (Output)
Store the n eigenvalues in the space evalu.
IMSL_A_COL_DIM, int a_col_dim (Input)
The column dimension of A.
Default: a_col_dim = n
IMSL_B_COL_DIM, int b_col_dim (Input)
The column dimension of B.
Default: b_col_dim = n
IMSL_EVECU_COL_DIM, int evecu_col_dim (Input)
The column dimension of evecu.
Default: evecu_col_dim = n
Description
The function imsl_f_eig_symgen computes the eigenvalues of a symmetric, positive definite eigenvalue problem by a three-phase process (Martin and Wilkinson 1971). The matrix B is reduced to factored form using the Cholesky decomposition. These factors are used to form a congruence transformation that yields a symmetric real matrix whose eigenexpansion is obtained. The problem is then transformed back to the original coordinates. Eigenvectors are calculated and transformed as required.
Example 1
 
#include <imsl.h>
 
int main()
{
int n = 3;
float a[] = {1.1, 1.2, 1.4,
1.2, 1.3, 1.5,
1.4, 1.5, 1.6};
float b[] = {2.0, 1.0, 0.0,
1.0, 2.0, 1.0,
0.0, 1.0, 2.0};
float *eval;
/* Solve for eigenvalues */
eval = imsl_f_eig_symgen (n, a, b, 0);
/* Print eigenvalues */
imsl_f_write_matrix ("Eigenvalues", 1, n, eval, 0);
}
Output
 
Eigenvalues
1 2 3
1.386 -0.058 -0.003
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[] = {1.1, 1.2, 1.4,
1.2, 1.3, 1.5,
1.4, 1.5, 1.6};
float b[] = {2.0, 1.0, 0.0,
1.0, 2.0, 1.0,
0.0, 1.0, 2.0};
float *eval;
float *evec;
/* Solve for eigenvalues and eigenvectors */
eval = imsl_f_eig_symgen (n, a, b,
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
1.386 -0.058 -0.003
 
Eigenvectors
1 2 3
1 0.6431 -0.1147 -0.6817
2 -0.0224 -0.6872 0.7266
3 0.7655 0.7174 -0.0858
Warning Errors
IMSL_SLOW_CONVERGENCE_SYM
The iteration for an eigenvalue failed to converge in 100 iterations before deflating.
Fatal Errors
IMSL_SUBMATRIX_NOT_POS_DEFINITE
The leading # by # submatrix of the input matrix is not positive definite.
IMSL_MATRIX_B_NOT_POS_DEFINITE
Matrix B is not positive definite.