eigSymgen¶
Computes the generalized eigenexpansion of a system \(Ax = \lambda Bx\). The matrices A and B are real and symmetric, and B is positive definite.
Synopsis¶
eigSymgen (a, b)
Required Arguments¶
- 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¶
The n
eigenvalues of the symmetric matrix. If no value can be computed,
then None
is returned.
Optional Arguments¶
vectors
(Output)- An array of size
n
×n
containing eigenvectors of the problem.
Description¶
The function eigSymgen
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.
Examples¶
Example 1¶
from numpy import *
from pyimsl.math.eigSymgen import eigSymgen
from pyimsl.math.writeMatrix import writeMatrix
a = [[1.1, 1.2, 1.4],
[1.2, 1.3, 1.5],
[1.4, 1.5, 1.6]]
b = [[2.0, 1.0, 0.0],
[1.0, 2.0, 1.0],
[0.0, 1.0, 2.0]]
# Solve for eigenvalues
eval = eigSymgen(a, b)
# Print eigenvalues
writeMatrix("Eigenvalues", eval)
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.
from numpy import *
from pyimsl.math.eigSymgen import eigSymgen
from pyimsl.math.writeMatrix import writeMatrix
a = [[1.1, 1.2, 1.4],
[1.2, 1.3, 1.5],
[1.4, 1.5, 1.6]]
b = [[2.0, 1.0, 0.0],
[1.0, 2.0, 1.0],
[0.0, 1.0, 2.0]]
evec = []
# Solve for eigenvalues and eigenvectors
eval = eigSymgen(a, b, vectors=evec)
# Print eigenvalues and eigenvectors
writeMatrix("Eigenvalues", eval)
writeMatrix("Eigenvectors", evec)
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. |