XLPack 6.1
Excel VBA Numerical Library Reference Manual
Loading...
Searching...
No Matches

◆ Zhbtrd()

Sub Zhbtrd ( Vect As  String,
Uplo As  String,
N As  Long,
Kd As  Long,
Ab() As  Complex,
D() As  Double,
E() As  Double,
Q() As  Complex,
Info As  Long 
)

Reduces a real Hermitian band matrix to tridiagonal form

Purpose
This routine reduces a Hermitian band matrix A to real symmetric tridiagonal form T by an unitary similarity transformation: Q^H * A * Q = T.
Parameters
[in]Vect= "N": Do not form Q.
= "V": Form Q.
= "U": Update a matrix X, by forming X*Q.
[in]Uplo= "U": Upper triangle of A is stored.
= "L": Lower triangle of A is stored.
[in]NOrder of the matrix A. (N >= 0) (If N = 0, returns without computation)
[in]KdNumber of superdiagonals of the matrix A if Uplo = "U" or number of subdiagonals if Uplo = "L". (Kd >= 0)
[in,out]Ab()Array Ab(LAb1 - 1, LAb2 - 1) (LAb1 >= Kd + 1, LAb2 >= N)
[in] The upper or lower triangle of the Hermitian band matrix A, stored in the first Kd + 1 rows of the array. The j-th column of A is stored in the j-th column of the array Ab() as follows.
Uplo = "U": ab[j][Kd + i - j] = A(i, j) for max(0, j - Kd - 1) <= i <= j <= N - 1.
Uplo = "L": ab[j][i - j] = A(i, j) for 0 <= j <= i <= min(N - 1, j + Kd - 1).
[out] The diagonal elements of Ab() are overwritten by the diagonal elements of the tridiagonal matrix T. If Kd > 0, the elements on the first superdiagonal (if Uplo = "U") or the first subdiagonal (if Uplo = "L") are overwritten by the off-diagonal elements of T. The rest of Ab() is overwritten by values generated during the reduction.
[out]D()Array D(LD - 1) (LD >= N)
The diagonal elements of the tridiagonal matrix T: D(i) = Tii.
[out]E()Array E(LE - 1) (LE >= N - 1)
The off-diagonal elements of the tridiagonal matrix T: E(i) = T(i+1, i) if Uplo = "U", E(i) = T(i, i+1) if Uplo = "L".
[in,out]Q()Array Q(LQ1 - 1, LQ2 - 1) (LQ1 >= N, LQ2 >= N)
[in] If Vect = "U", then Q() must contain an N x N matrix X. If Vect = "N" or "V", then Q() need not be set.
[out] If Vect = "V", Q() contains the N x N unitary matrix Q. If Vect = "U", Q() contains the product X*Q. If Vect = "N", the array Q() is not referenced.
[out]Info= 0: Successful exit.
= -1: The argument Vect had an illegal value. (Vect <> "N", "V" nor "Q")
= -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 Kd had an illegal value. (Kd < 0)
= -5: The argument Ab() is invalid.
= -6: The argument D() is invalid.
= -7: The argument E() is invalid.
= -8: The argument Q() is invalid.
Reference
LAPACK
Example Program
Compute all eigenvalues and eigenvectors of the Hermitian band matrix A, where
( 2.20 -0.32-0.81i 0 )
A = ( -0.32+0.81i 2.11 0.37+0.80i )
( 0 0.37-0.80i 2.93 )
Reduces to real tridiagonal form by Zhbtrd, then Dsterf is applied.
Sub Ex_Zhbtrd_Dsterf()
Const N = 3, Kd = 1
Dim Ab(Kd, N - 1) As Complex, Q() As Complex
Dim D(N - 1) As Double, E(N - 2) As Double, Info As Long
Ab(0, 0) = Cmplx(2.2, 0): Ab(0, 1) = Cmplx(2.11, 0): Ab(0, 2) = Cmplx(2.93, 0)
Ab(1, 0) = Cmplx(-0.32, 0.81): Ab(1, 1) = Cmplx(0.37, -0.8)
Call Zhbtrd("N", "L", N, Kd, Ab(), D(), E(), Q(), Info)
If Info <> 0 Then
Debug.Print "Error in Zhbtrd: Info =", Info
Exit Sub
End If
Call Dsterf(N, D(), E(), Info)
If Info <> 0 Then
Debug.Print "Error in Dsterf: Info =", Info
Exit Sub
End If
Debug.Print "Eigenvalues =", D(0), D(1), D(2)
End Sub
Example Results
Eigenvalues = 1.04283948355918 2.52504447979701 3.67211603664382