eigGenComplex

Computes the eigenexpansion of a complex matrix A.

Synopsis

eigGenComplex (a)

Required Arguments

complex a[[]] (Input)
Array of size n ×n containing the matrix.

Return Value

The n complex 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.

Description

The function eigGenComplex computes the eigenvalues of a complex matrix by a two-phase process. The matrix is reduced to upper Hessenberg form by elementary Gauss transformations. Then, the eigenvalues are computed using an explicitly shifted LR algorithm. Eigenvectors are calculated during the iterations for the eigenvalues (Martin and Wilkinson 1971).

Examples

Example 1

from numpy import *
from pyimsl.math.eigGenComplex import eigGenComplex
from pyimsl.math.writeMatrixComplex import writeMatrixComplex

a = [[5 + 9j, 5 + 5j, -6 - 6j, -7 - 7j],
     [3 + 3j, 6 + 10j, -5 - 5j, -6 - 6j],
     [2 + 2j, 3 + 3j, -1 + 3j, -5 - 5j],
     [1 + 1j, 2 + 2j, -3 - 3j, 0 + 4j]]

# Compute eigenvalues
eval = eigGenComplex(a)

# Print eigenvalues
writeMatrixComplex("Eigenvalues", eval)

Output

 
                     Eigenvalues
                        1                          2
(          4,          8)  (          3,          7)
 
                        3                          4
(          2,          6)  (          1,          5)

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.eigGenComplex import eigGenComplex
from pyimsl.math.writeMatrixComplex import writeMatrixComplex

a = [[5 + 9j, 5 + 5j, -6 - 6j, -7 - 7j],
     [3 + 3j, 6 + 10j, -5 - 5j, -6 - 6j],
     [2 + 2j, 3 + 3j, -1 + 3j, -5 - 5j],
     [1 + 1j, 2 + 2j, -3 - 3j, 0 + 4j]]
evec = []

# Compute eigenvalues and eigenvectors
eval = eigGenComplex(a, vectors=evec)

# Print eigenvalues and eigenvectors
writeMatrixComplex("Eigenvalues", eval)
writeMatrixComplex("Eigenvectors", evec)

Output

 
                     Eigenvalues
                        1                          2
(          4,          8)  (          3,          7)
 
                        3                          4
(          2,          6)  (          1,          5)
 
                     Eigenvectors
                           1                          2
1  (     0.5774,     0.0000)  (     0.5774,     0.0000)
2  (     0.5774,    -0.0000)  (     0.5774,    -0.0000)
3  (     0.5774,    -0.0000)  (    -0.0000,     0.0000)
4  (    -0.0000,     0.0000)  (     0.5774,    -0.0000)
 
                           3                          4
1  (     0.3780,     0.0000)  (     0.7559,     0.0000)
2  (     0.7559,     0.0000)  (     0.3780,    -0.0000)
3  (     0.3780,     0.0000)  (     0.3780,    -0.0000)
4  (     0.3780,     0.0000)  (     0.3780,    -0.0000)

Fatal Errors

IMSL_SLOW_CONVERGENCE_GEN

The iteration for an eigenvalue did not converge after

# iterations.