eigHermComplex¶
Computes the eigenexpansion of a complex Hermitian matrix A.
Synopsis¶
eigHermComplex (a)
Required Arguments¶
- complex
a[[]]
(Input) - Array of size
n
×n
containing the matrix.
Return Value¶
The n
eigenvalues of the 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 matrix. range
, floatelow
, floatehigh
(Input)Return eigenvalues and optionally eigenvectors that lie in the interval with lower limit
elow
and upper limitehigh
.Default: (
elow
,ehigh
) = (−∞, +∞).returnNumber
(Output)- The number of output eigenvalues and eigenvectors in the range
elow
,ehigh
.
Description¶
The function eigHermComplex
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¶
from numpy import *
from pyimsl.math.eigHermComplex import eigHermComplex
from pyimsl.math.writeMatrix import writeMatrix
a = [[1 + 0j, 1 - 7j, 0 - 1j],
[1 + 7j, 5 + 0j, 10 - 3j],
[0 + 1j, 10 + 3j, -2 + 0j]]
# Compute eigenvalues
eval = eigHermComplex(a)
# Print eigenvalues
writeMatrix("Eigenvalues", eval)
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.
from numpy import *
from pyimsl.math.eigHermComplex import eigHermComplex
from pyimsl.math.writeMatrix import writeMatrix
from pyimsl.math.writeMatrixComplex import writeMatrixComplex
a = [[1 + 0j, 1 - 7j, 0 - 1j],
[1 + 7j, 5 + 0j, 10 - 3j],
[0 + 1j, 10 + 3j, -2 + 0j]]
evec = []
# Compute eigenvalues and eigenvectors
eval = eigHermComplex(a, vectors=evec)
# Print eigenvalues and eigenvectors
writeMatrix("Eigenvalues", eval)
writeMatrixComplex("Eigenvectors", evec)
Output¶
Eigenvalues
1 2 3
15.38 -10.63 -0.75
Eigenvectors
1 2
1 ( 0.0631, -0.4075) ( -0.0598, -0.3117)
2 ( 0.7703, 0.0000) ( -0.5939, 0.1841)
3 ( 0.4668, 0.1366) ( 0.7160, 0.0000)
3
1 ( 0.8539, 0.0000)
2 ( -0.0313, -0.1380)
3 ( 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. |