|
◆ Zhseqr()
Sub Zhseqr |
( |
Job As |
String, |
|
|
Compz As |
String, |
|
|
N As |
Long, |
|
|
Ilo As |
Long, |
|
|
Ihi As |
Long, |
|
|
H() As |
Complex, |
|
|
W() As |
Complex, |
|
|
Z() As |
Complex, |
|
|
Info As |
Long |
|
) |
| |
Eigenvalues and Schur factorization of complex Hessenberg matrix by QR method
- Purpose
- This routine computes the eigenvalues of a Hessenberg matrix H and, optionally, the matrices T and Z from the Schur decomposition H = Z T Z^H, where T is an upper quasi-triangular matrix (the Schur form), and Z is the unitary matrix of Schur vectors.
Optionally Z may be postmultiplied into an input unitary matrix Q so that this routine can give the Schur factorization of a matrix A which has been reduced to the Hessenberg form H by the unitary matrix Q: A = Q*H*Q^H = (QZ)*T*(QZ)^H.
- Parameters
-
[in] | Job | = "E": Compute eigenvalues only.
= "S": Compute eigenvalues and the Schur form T. |
[in] | Compz | = "N": No Schur vectors are computed.
= "I": Z() is initialized to the unit matrix and the matrix Z of Schur vectors of H is returned.
= "V": Z() must contain an unitary matrix Q on entry, and the product Q*Z is returned. |
[in] | N | Order of the matrix H. (N >= 0) (If N = 0, returns without computation) |
[in] | Ilo | |
[in] | Ihi | It is assumed that H is already upper triangular in rows and columns 1〜Ilo-1 and Ihi+1〜N. Ilo and Ihi are normally set by a previous call to Zgebal, and then passed to Zgehrd when the matrix output by Zgebal is reduced to Hessenberg form. Otherwise they should be set to 1 and N respectively. (1 <= Ilo <= Ihi <= N, if N > 0. Ilo = 1 and Ihi = 0, if N = 0) |
[in,out] | H() | Array H(LH1 - 1, LH2 - 1) (LH1 >= N, LH2 >= N)
[in] The upper Hessenberg matrix H.
[out] If Info = 0 and Job = "S", then H contains the upper triangular matrix T from the Schur decomposition (the Schur form). If Info = 0 and Job = "E", the contents of H are unspecified on exit. (The output value of H when Info > 0 is given under the description of Info below.) |
[out] | W() | Array W(LW - 1) (LW >= N)
The computed eigenvalues. If Job = "S", the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in H(), with W(i) = H(i, i). |
[in,out] | Z() | Array Z(LZ1 - 1, LZ2 - 1) (LZ1 >= N, LZ2 >= N)
Compz = "I":
[in] Z() need not be set.
[out] if Info = 0, Z() contains the unitary matrix Z of the Schur vectors of H.
Compz = "V":
[in] Z() must contain an N x N matrix Q, which is assumed to be equal to the unit matrix except for the submatrix Z(Ilo〜Ihi, Ilo〜Ihi).
[out] If Info = 0, Z() contains Q*Z. Normally Q is the unitary matrix generated by Zunghr after the call to Zgehrd which formed the Hessenberg matrix H. (The output value of Z() when Info > 0 is given under the description of Info below.)
Compz = "N": Z() is not referenced. |
[out] | Info | = 0: Successful exit.
= -1: The argument Job had an illegal value. (Job <> "E" nor "S")
= -2: The argument Compz had an illegal value. (Compz <> "N", "I" nor "V")
= -3: The argument N had an illegal value. (N < 0)
= -4: The argument Ilo had an illegal value. (Ilo < 1 or Ilo > N)
= -5: The argument Ihi had an illegal value. (Ihi < min(Ilo, N) or Ihi > N)
= -6: The argument H() is invalid.
= -7: The argument W() is invalid.
= -8: The argument Z() is invalid.
= i > 0: Failed to compute all of the eigenvalues. Elements 1〜Ilo-1 and i+1〜N of W() contain those eigenvalues which have been successfully computed. (Failures are rare.)
If Job = "E", the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columns Ilo through i of the final output value of H().
If Job = "S", then (initial value of H()) * U = U * (final value of H()) --- (*)
where U is an unitary matrix. The final value of H() is upper Hessenberg and quasi-triangular in rows and columns i+1 through Ihi.
If Compz = "V", then (final value of Z()) = (initial value of Z()) * U
where U is the unitary matrix in (*) (regardless of the value of Job.)
If Compz = "I", then where U is the unitary matrix in (*) (regardless of the value of Job.)
If Compz = "N", then Z() is not accessed. |
- Reference
- LAPACK
- Example Program
- Compute all eigenvalues of the general matrix A, where
( 0.20-0.11i -0.93-0.32i 0.81+0.37i )
A = ( -0.80-0.92i -0.29+0.86i 0.64+0.51i )
( 0.71+0.59i -0.15+0.19i 0.20+0.94i )
Reduces to Hessenberg form by Zgehrd, then computes eigenvalues by Zhseqr.
See examples of Ztrevc3 and Zhsein which also compute eigenvectors. Sub Ex_Zgehrd_Zhseqr()
Const N = 3
Dim A(N - 1, N - 1) As Complex, Tau(N - 2) As Complex
Dim W(N - 1) As Complex, Z() As Complex
Dim Ilo As Long, Ihi As Long, Info As Long
A(0, 0) = Cmplx(0.2, -0.11): A(0, 1) = Cmplx(-0.93, -0.32): A(0, 2) = Cmplx(0.81, 0.37)
A(1, 0) = Cmplx(-0.8, -0.92): A(1, 1) = Cmplx(-0.29, 0.86): A(1, 2) = Cmplx(0.64, 0.51)
A(2, 0) = Cmplx(0.71, 0.59): A(2, 1) = Cmplx(-0.15, 0.19): A(2, 2) = Cmplx(0.2, 0.94)
Ilo = 1: Ihi = N
Call Zgehrd(N, Ilo, Ihi, A(), Tau(), Info)
If Info <> 0 Then
Debug.Print "Error in Zgehrd: Info =", Info
Exit Sub
End If
Call Zhseqr("E", "N", N, Ilo, Ihi, A(), W(), Z(), Info)
If Info <> 0 Then
Debug.Print "Error in Zhseqr: Info =", Info
Exit Sub
End If
Debug.Print "Eigenvalues ="
Debug.Print Creal(W(0)), Cimag(W(0)), Creal(W(1)), Cimag(W(1))
Debug.Print Creal(W(2)), Cimag(W(2))
End Sub
- Example Results
Eigenvalues =
-1.15894122423918 -0.50662892448174 1.05593587167591 0.900255855387815
0.21300535256327 1.29637306909393
|