|
|
◆ Ztbtrs()
| Sub Ztbtrs |
( |
Uplo As |
String, |
|
|
Trans As |
String, |
|
|
Diag As |
String, |
|
|
N As |
Long, |
|
|
Kd As |
Long, |
|
|
Ab() As |
Complex, |
|
|
B() As |
Complex, |
|
|
Info As |
Long, |
|
|
Optional Nrhs As |
Long = 1 |
|
) |
| |
Solution to system of linear equations AX = B, ATX = B or AHX = B for a complex triangular band matrix
- Purpose
- This routine solves a triangular system of the form
A * X = B, A^T * X = B or A^H * X = B
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": A^T * X = B. (transpose)
= "C": A^H * X = B. (conjugate 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.15-0.23i 0 0 )
A = ( -0.57-0.30i -0.37-2.84i 0 )
( 0 -0.04-0.01i -0.18-0.04i )
( -0.0932+0.3296i )
B = ( 0.4796-1.3938i )
( -0.1056-0.0724i )
Sub Ex_Ztbtrs()
Const N = 3, Kd = 1
Dim Ab(Kd, N - 1) As Complex, B(N - 1) As Complex
Dim RCond As Double, Info As Long
Ab(0, 0) = Cmplx(-0.15, -0.23): Ab(0, 1) = Cmplx(-0.37, -2.84): Ab(0, 2) = Cmplx(-0.18, -0.04)
Ab(1, 0) = Cmplx(-0.57, -0.3): Ab(1, 1) = Cmplx(-0.04, -0.01)
B(0) = Cmplx(-0.0932, 0.3296): B(1) = Cmplx(0.4796, -1.3938): B(2) = Cmplx(-0.1056, -0.0724)
Call Ztbtrs("L", "N", "N", N, Kd, Ab(), B(), Info)
If Info = 0 Then Call Ztbcon("1", "L", "N", N, Kd, Ab(), RCond, Info)
Debug.Print "X =",
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Function Cmplx(R As Double, Optional I As Double=0) As Complex Building complex number
Function Cimag(A As Complex) As Double Imaginary part of complex number
Function Creal(A As Complex) As Double Real part of complex number
Sub Ztbtrs(Uplo As String, Trans As String, Diag As String, N As Long, Kd As Long, Ab() As Complex, B() As Complex, Info As Long, Optional Nrhs As Long=1) Solution to system of linear equations AX = B, ATX = B or AHX = B for a complex triangular band matri...
Sub Ztbcon(Norm As String, Uplo As String, Diag As String, N As Long, Kd As Long, Ab() As Complex, RCond As Double, Info As Long) Condition number of a complex triangular band matrix
- Example Results
X = -0.82 -0.94 0.74 0.2 0.48 0.21
RCond = 0.063468564549167
Info = 0
|