|
|
◆ Zheevd()
| Sub Zheevd |
( |
Jobz As |
String, |
|
|
Uplo As |
String, |
|
|
N As |
Long, |
|
|
A() As |
Complex, |
|
|
W() As |
Double, |
|
|
Info As |
Long |
|
) |
| |
(Divide and conquer driver) Eigenvalues and eigenvectors of a Hermitian matrix
- Purpose
- This routine computes all eigenvalues and, optionally, eigenvectors of a Hermitian matrix A. If only eigenvalues are desired, it uses a QL or QR method. If eigenvectors are also desired, it uses a divide and conquer algorithm.
- Parameters
-
| [in] | Jobz | = "N": Compute eigenvalues only.
= "V": Compute eigenvalues and eigenvectors. |
| [in] | Uplo | = "U": Upper triangle of A is stored.
= "L": Lower triangle of A is stored. |
| [in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in,out] | A() | Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
[in] The Hermitian matrix A. If Uplo = "U", the leading N x N upper triangular part of A() contains the upper triangular part of the matrix A. If Uplo = "L", the leading N x N lower triangular part of A() contains the lower triangular part of the matrix A.
[out] Jobz = "V": If Info = 0, A() contains the orthonormal eigenvectors of the matrix A.
Jobz = "N": The lower triangle (if Uplo = "L") or the upper triangle (if Uplo = "U") of A(), including the diagonal, is destroyed. |
| [out] | W() | Array W(LW - 1) (LW >= N)
If Info = 0, the eigenvalues in ascending order. |
| [out] | Info | = 0: Successful exit.
= -1: The argument Jobz had an illegal value. (Jobz <> "V" nor "N")
= -2: The argument Uplo had an illegal value. (Uplo <> "U" nor "L")
= -3: The argument N had an illegal value. (N < 0)
= -4: The argument A() is invalid.
= -5: The argument W() is invalid.
= i > 0: The algorithm failed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero |
- Reference
- LAPACK
- Example Program
- Compute all eigenvalues and eigenvectors of the Hermitian matrix A, where
( 0.20 -0.11+0.93i 0.81-0.37i )
A = ( -0.11-0.93i -0.32 -0.80+0.92i )
( 0.81+0.37i -0.80-0.92i -0.29 )
Sub Ex_Zheevd()
Const N = 3
Dim A(N - 1, N - 1) As Complex, W(N - 1) As Double, Info As Long
A(1, 0) = Cmplx(-0.11, -0.93): A(1, 1) = Cmplx(-0.32, 0)
A(2, 0) = Cmplx(0.81, 0.37): A(2, 1) = Cmplx(-0.8, -0.92): A(2, 2) = Cmplx(-0.29, 0)
Call Zheevd("V", "L", N, A(), W(), Info)
Debug.Print "Eigenvalues =", W(0), W(1), W(2)
Debug.Print "Eigenvectors ="
Debug.Print "Info =", Info
End Sub
Function Cmplx(R As Double, Optional I As Double=0) As Complex Building complex number
Function Cimag(A As Complex) As Double Imaginary part of complex number
Function Creal(A As Complex) As Double Real part of complex number
Sub Zheevd(Jobz As String, Uplo As String, N As Long, A() As Complex, W() As Double, Info As Long) (Divide and conquer driver) Eigenvalues and eigenvectors of a Hermitian matrix
- Example Results
Eigenvalues = -2.05348849668514 0.124622388617308 1.51886610806783
Eigenvectors =
-0.449276526719113 -0 0.654793596518192 0
0.227247885813611 -0.597641779578735 0.519997178670921 -3.19846835072552E-02
0.621236109316912 -5.83009495222983E-02 0.204907317474214 -0.507777757881847
-0.607779522934083 0
0.392237107311198 0.407323787101333
-0.23846608290599 -0.503959683819116
Info = 0
|