|
|
◆ Ztptrs()
| Sub Ztptrs |
( |
Uplo As |
String, |
|
|
Trans As |
String, |
|
|
Diag As |
String, |
|
|
N As |
Long, |
|
|
Ap() 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 matrix in packed form
- 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 matrix of order n stored in packed form, 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 Ap() 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] | Ap() | Array Ap(LAp - 1) (LAp >= N(N + 1)/2)
N x N triangular matrix A in packed symmetric 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 Ap() is invalid.
= -6: The argument B() is invalid.
= -8: 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.20-0.11i 0 0 )
A = ( -0.93-0.32i 0.81+0.37i 0 )
( -0.80-0.92i -0.29+0.86i 0.64+0.51i )
( 0.2069+0.0399i )
B = ( -0.6633-0.6775i )
( -0.4965-0.6057i )
Sub Ex_Ztptrs()
Const N = 3
Dim Ap(N * (N + 1) / 2) As Complex, B(N - 1) As Complex
Dim RCond As Double, Info As Long
Ap(0) = Cmplx(0.2, -0.11)
Ap(1) = Cmplx(-0.93, -0.32): Ap(3) = Cmplx(0.81, 0.37)
Ap(2) = Cmplx(-0.8, -0.92): Ap(4) = Cmplx(-0.29, 0.86): Ap(5) = Cmplx(0.64, 0.51)
B(0) = Cmplx(0.2069, 0.0399): B(1) = Cmplx(-0.6633, -0.6775): B(2) = Cmplx(-0.4965, -0.6057)
Call Ztptrs("L", "N", "N", N, Ap(), B(), Info)
If Info = 0 Then Call Ztpcon("1", "L", "N", N, Ap(), 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 Ztpcon(Norm As String, Uplo As String, Diag As String, N As Long, Ap() As Complex, RCond As Double, Info As Long) Condition number of a complex triangular matrix in packed form
Sub Ztptrs(Uplo As String, Trans As String, Diag As String, N As Long, Ap() 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 matrix in ...
- Example Results
X = 0.71 0.59 -0.15 0.19 0.2 0.94
RCond = 2.79371684875664E-02
Info = 0
|