|
|
◆ Dtbtrs()
| Sub Dtbtrs |
( |
Uplo As |
String, |
|
|
Trans As |
String, |
|
|
Diag As |
String, |
|
|
N As |
Long, |
|
|
Kd As |
Long, |
|
|
Ab() As |
Double, |
|
|
B() As |
Double, |
|
|
Info As |
Long, |
|
|
Optional Nrhs As |
Long = 1 |
|
) |
| |
Solution to system of linear equations AX = B or ATX = B for a triangular band matrix
- Purpose
- This routine solves a triangular system of the form where A is a triangular band matrix of order n and B is an n x nrhs matrix. A check is made to verify that A is nonsingular.
- Parameters
-
| [in] | Uplo | = "U": A is upper triangular.
= "L": A is lower triangular. |
| [in] | Trans | Specifies the form of the system of equations:
= "N": A * X = B. (no transpose)
= "T" or "C": A^T * X = B. (transpose) |
| [in] | Diag | = "N": A is non-unit triangular.
= "U": A is unit triangular. (Diagonal elements of Ab() are not referenced and are assumed to be 1) |
| [in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in] | Kd | Number of super-diagonals or sub-diagonals of the triangular band matrix A. (Kd >= 0) |
| [in] | Ab() | Array Ab(LAb1 - 1, LAb2 - 1) (LAb1 >= Kd + 1, LAb2 >= N)
N x N triangular band matrix A in Kd+1 x N symmetric band matrix form. Upper or lower part is to be stored in accordance with Uplo. |
| [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 matrix of right hand side matrix B.
[out] If Info = 0, the N x Nrhs solution matrix X. |
| [out] | Info | = 0: Successful exit.
= -1: The argument Uplo had an illegal value. (Uplo <> "U" nor "L")
= -2: The argument Trans had an illegal value. (Trans <> "N", "T" nor "C")
= -3: The argument Diag had an illegal value. (Diag <> "N" nor "U")
= -4: The argument N had an illegal value. (N < 0)
= -5: The argument Kd had an illegal value. (Kd < 0)
= -6: The argument Ab() is invalid.
= -7: The argument B() is invalid.
= -9: The argument Nrhs had an illegal value. (Nrhs < 0)
= i > 0: The i-th diagonal element of A is zero, indicating that the matrix is singular and the solutions X have not been computed. |
| [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
( -0.40 0 0 ) ( -0.0800 )
A = ( 2.06 0.52 0 ), B = ( 0.6616 )
( 0 -0.74 -2.72 ) ( -0.9264 )
Sub Ex_Dtbtrs()
Const N = 3, Kd = 1
Dim Ab(Kd, N - 1) As Double, B(N - 1) As Double
Dim RCond As Double, Info As Long
Ab(0, 0) = -0.4: Ab(0, 1) = 0.52: Ab(0, 2) = -2.72
Ab(1, 0) = 2.06: Ab(1, 1) = -0.74
B(0) = -0.08: B(1) = 0.6616: B(2) = -0.9264
Call Dtbtrs("L", "N", "N", N, Kd, Ab(), B(), Info)
If Info = 0 Then Call Dtbcon("1", "L", "N", N, Kd, Ab(), RCond, Info)
Debug.Print "X =", B(0), B(1), B(2)
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Sub Dtbcon(Norm As String, Uplo As String, Diag As String, N As Long, Kd As Long, Ab() As Double, RCond As Double, Info As Long) Condition number of a triangular band matrix
Sub Dtbtrs(Uplo As String, Trans As String, Diag As String, N As Long, Kd As Long, Ab() As Double, B() As Double, Info As Long, Optional Nrhs As Long=1) Solution to system of linear equations AX = B or ATX = B for a triangular band matrix
- Example Results
X = 0.2 0.48 0.21
RCond = 2.43502692577851E-02
Info = 0
|