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

◆ Dpttrf()

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

LDLT factorization of a symmetric positive definite tridiagonal matrix

Purpose
This routine computes the L*D*L^T factorization of a real symmetric positive definite tridiagonal matrix A. The factorization may also be regarded as having the form A = U^T*D*U.
Parameters
[in]NOrder of the matrix A. (N >= 0) (If N = 0, returns without computation)
[in,out]D()Array D(LD - 1) (LD >= N)
[in] N diagonal elements of the symmetric positive definite tridiagonal matrix A.
[out] N diagonal elements of the diagonal matrix D from the factorization A = L*D*L^T.
[in,out]E()Array E(LE - 1) (LE >= N - 1)
[in] N-1 sub-diagonal elements of the symmetric positive definite tridiagonal matrix A.
[out] N-1 sub-diagonal elements of the unit bidiagonal factor L from the L*D*L^T factorization of A. E can also be regarded as the super-diagonal of the unit bidiagonal factor U from the U^T*D*U factorization of A.
[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 leading minor of order i is not positive definite. If i < N, the factorization could not been completed, while if i = N, the factorization was completed, but D(N-1) <= 0.
Reference
LAPACK
Example Program
Solve the system of linear equations Ax = B and estimate the reciprocal of the condition number (RCond) of A, where A is symmetric positive definite tridiagonal matrix and
( 2.58 -0.99 0 ) ( -1.1850 )
A = ( -0.99 0.69 -0.03 ), B = ( 0.1410 )
( 0 -0.03 0.18 ) ( 0.1614 )
Sub Ex_Dpttrf()
Const N As Long = 3
Dim D(N - 1) As Double, E(N - 2) As Double, B(N - 1) As Double
Dim ANorm As Double, RCond As Double, Info As Long
D(0) = 2.58: D(1) = 0.69: D(2) = 0.18
E(0) = -0.99: E(1) = -0.03
B(0) = -1.185: B(1) = 0.141: B(2) = 0.1614
ANorm = Dlanst("1", N, D(), E())
Call Dpttrf(N, D(), E(), Info)
If Info = 0 Then Call Dpttrs(N, D(), E(), B(), Info)
If Info = 0 Then Call Dptcon(N, D(), E(), ANorm, RCond, Info)
Debug.Print "X =", B(0), B(1), B(2)
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Function Dlanst(Norm As String, N As Long, D() As Double, E() As Double, Optional Info As Long) As Double
One norm, Frobenius norm, infinity norm, or largest absolute value of any element of a symmetric trid...
Sub Dptcon(N As Long, D() As Double, E() As Double, ANorm As Double, RCond As Double, Info As Long)
Condition number of a symmetric positive definite tridiagonal matrix
Sub Dpttrs(N As Long, D() As Double, E() As Double, B() As Double, Info As Long, Optional Nrhs As Long=1)
Solution to factorized system of linear equations AX = B for a symmetric positive definite tridiagona...
Sub Dpttrf(N As Long, D() As Double, E() As Double, Info As Long)
LDLT factorization of a symmetric positive definite tridiagonal matrix
Example Results
X = -0.82 -0.94 0.74
RCond = 0.0437508336668
Info = 0