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

◆ Dptsv()

Sub Dptsv ( N As  Long,
D() As  Double,
E() As  Double,
B() As  Double,
Info As  Long,
Optional Nrhs As  Long = 1 
)

(Simple driver) Solution to system of linear equations AX = B for a symmetric positive definite tridiagonal matrix

Purpose
This routine computes the solution to a real system of linear equations
A * X = B,
where A is an n x n symmetric positive definite tridiagonal matrix, and X and B are n x nrhs matrices.

A is factored as A = L*D*L^T, and the factored form of A is then used to solve the system of equations.
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.
[in,out]B()Array B(LB1 - 1, LB2 - 1) (LB1 >= max(1, N), LB2 >= Nrhs) (2D array) or B(LB - 1) (LB >= max(1, N), Nrhs = 1) (1D array)
[in] N x Nrhs right hand side matrix B.
[out] If Info = 0, the N x Nrhs solution matrix X.
[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.
= -4: The argument B() is invalid.
= -6: The argument Nrhs had an illegal value. (Nrhs < 0)
= i > 0: The leading minor of order i is not positive definite, and the solution has not been computed. The factorization has not been completed unless i = N.
[in]Nrhs(Optional)
Number of right hand sides, i.e., number of columns of the matrix B. (Nrhs >= 0) (If Nrhs = 0, returns without computation) (default = 1)
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_Dptsv()
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 Dptsv(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 Dptsv(N As Long, D() As Double, E() As Double, B() As Double, Info As Long, Optional Nrhs As Long=1)
(Simple driver) Solution to system of linear equations AX = B for a symmetric positive definite tridi...
Example Results
X = -0.82 -0.94 0.74
RCond = 0.0437508336668
Info = 0