XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Dsterf()

Sub Dsterf ( N As  Long,
D() As  Double,
E() As  Double,
Info As  Long 
)

Eigenvalues of a symmetric tridiagonal matrix (QL or QR method)

Purpose
This routine computes all eigenvalues of a symmetric tridiagonal matrix using the Pal-Walker-Kahan variant of the QL or QR algorithm.
Parameters
[in]NOrder of the matrix. (N >= 0) (If N = 0, returns without computation)
[in,out]D()Array D(LD - 1) (LD >= N)
[in] The diagonal elements of the tridiagonal matrix.
[out] If Info = 0, the eigenvalues in ascending order.
[in,out]E()Array E(LE - 1) (LE >= N - 1)
[in] The (N-1) subdiagonal elements of the tridiagonal matrix.
[out] E() has been destroyed.
[out]Info= 0: Successful exit.
= -1: The argument N had an illegal value. (N < 0)
= -2: The argument D() is invalid.
= -3: The argument E() is invalid.
= i > 0: The algorithm has failed to find all of the eigenvalues in a total of 30*N iterations. i elements of E() have not converged to zero.
Reference
LAPACK
Example Program
Compute all eigenvalues of the symmetric matrix A, where
( 2.20 -0.11 -0.32 )
A = ( -0.11 2.93 0.81 )
( -0.32 0.81 2.37 )
Reduces to tridiagonal form by Dsytrd, then Dsterf is applied.
Sub Ex_Dsytrd_Dsterf()
Const N = 3
Dim A(N - 1, N - 1) As Double, Info As Long
Dim D(N - 1) As Double, E(N - 2) As Double, Tau(N - 2) As Double
A(0, 0) = 2.2
A(1, 0) = -0.11: A(1, 1) = 2.93
A(2, 0) = -0.32: A(2, 1) = 0.81: A(2, 2) = 2.37
Call Dsytrd("L", N, A(), D(), E(), Tau(), Info)
If Info <> 0 Then
Debug.Print "Error in Dsytrd: 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
Sub Dsterf(N As Long, D() As Double, E() As Double, Info As Long)
Eigenvalues of a symmetric tridiagonal matrix (QL or QR method)
Sub Dsytrd(Uplo As String, N As Long, A() As Double, D() As Double, E() As Double, Tau() As Double, Info As Long)
Reduces a real symmetric matrix to tridiagonal form
Example Results
Eigenvalues = 1.70705954911046 2.22943643244226 3.56350401844728