|
◆ Zptsvx()
Sub Zptsvx |
( |
Fact As |
String, |
|
|
N As |
Long, |
|
|
D() As |
Double, |
|
|
E() As |
Complex, |
|
|
Df() As |
Double, |
|
|
Ef() As |
Complex, |
|
|
B() As |
Complex, |
|
|
X() As |
Complex, |
|
|
RCond As |
Double, |
|
|
FErr() As |
Double, |
|
|
BErr() As |
Double, |
|
|
Info As |
Long, |
|
|
Optional Nrhs As |
Long = 1 |
|
) |
| |
(Expert driver) Solution to system of linear equations AX = B for a Hermitian positive definite tridiagonal matrix
- Purpose
- This routine uses the factorization A = L*D*L^H to compute the solution to a complex system of linear equations where A is an n x n Hermitian positive definite tridiagonal matrix, and X and B are n x nrhs matrices.
Error bounds on the solution and a condition estimate are also provided.
- Description
- The following steps are performed:
- If Fact = "N", the matrix A is factored as where L is a unit lower bidiagonal matrix and D is diagonal. The factorization can also be regarded as having the form
- If the leading i x i principal minor is not positive definite, then the routine returns with Info = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A. If the reciprocal of the condition number is less than machine precision, Info = n+1 is returned as a warning, but the routine still goes on to solve for X and compute error bounds as described below.
- The system of equations is solved for X using the factored form of A.
- Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
- Parameters
-
[in] | Fact | Specifies whether or not the factored form of A has been supplied on entry.
= "F": Df() and Ef() contain the factored form of A. Df() and Ef() will not be modified.
= "N": The matrix A will be copied to Df() and Ef() and factored. |
[in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
[in] | D() | Array D(LD - 1) (LD >= N)
N diagonal elements of the Hermitian positive definite tridiagonal matrix A. computed by Dpttrf. |
[in] | E() | Array E(LE - 1) (LE >= N - 1)
N-1 sub-diagonal elements of the Hermitian positive definite tridiagonal matrix A. |
[in,out] | Df() | Array Df(LDf - 1) (LDf >= N)
[in] If Fact = "F", n diagonal elements of the diagonal matrix D from the L*D*L^H factorization of A, are to be stored.
[out] If Fact = "N", n diagonal elements of the diagonal matrix D from the L*D*L^H factorization of A, are returned. |
[in,out] | Ef() | Array Ef(LEf - 1) (LEf >= N - 1)
[in] If Fact = "F", N-1 sub-diagonal elements of the unit bidiagonal factor L from the L*D*L^H factorization of A, are to be stored.
[out] If Fact = "N", N-1 sub-diagonal elements of the unit bidiagonal factor L from the L*D*L^H factorization of A, are returned. |
[in] | 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)
N x Nrhs right hand side matrix B. |
[out] | X() | Array X(LX1 - 1, LX2 - 1) (LX1 >= max(1, N), LX2 >= Nrhs) (2D array) or X(LX - 1) (LX >= max(1, N), Nrhs = 1) (1D array)
If Info = 0 or Info = N+1, the N x Nrhs solution matrix X. |
[out] | RCond | The reciprocal condition number of the matrix A. If RCond is less than the machine precision (in particular, if RCond = 0), the matrix is singular to working precision. This condition is indicated by a return code of Info > 0. |
[out] | FErr() | Array FErr(LFErr - 1) (LFErr >= Nrhs)
The forward error bound for each solution vector X(j) (the j-th column of the solution matrix X). If Xtrue is the true solution corresponding to X(j), FErr(j-1) is an estimated upper bound for the magnitude of the largest element in (X(j) - Xtrue) divided by the magnitude of the largest element in X(j). |
[out] | BErr() | Array BErr(LBErr - 1) (LBErr >= Nrhs)
The componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution). |
[out] | Info | = 0: Successful exit.
= -1: The argument Fact had an illegal value. (Fact <> "F" nor "N")
= -2: The argument N had an illegal value. (N < 0)
= -3: The argument D() is invalid.
= -4: The argument E() is invalid.
= -5: The argument Df() is invalid.
= -6: The argument Ef() is invalid.
= -7: The argument B() is invalid.
= -8: The argument X() is invalid.
= -10: The argument FErr() is invalid.
= -11: The argument BErr() is invalid.
= -13: The argument Nrhs had an illegal value. (Nrhs < 0) |
[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
( 2.88 0.29-0.44i 0 )
A = ( 0.29+0.44i 0.62 -0.01-0.02i )
( 0 -0.01+0.02i 0.46 )
( 1.6236-0.7300i )
B = ( 0.1581+0.1537i )
( 0.1132-0.2290i )
Sub Ex_Zptsvx()
Const N As Long = 3
Dim D(N - 1) As Double, E(N - 2) As Complex, B(N - 1) As Complex
Dim Df(N - 1) As Double, Ef(N - 2) As Complex, X(N - 1) As Complex
Dim FErr(0) As Double, BErr(0) As Double
Dim RCond As Double, Info As Long
D(0) = 2.88: D(1) = 0.62: D(2) = 0.46
E(0) = Cmplx(0.29, 0.44): E(1) = Cmplx(-0.01, 0.02)
B(0) = Cmplx(1.6236, -0.73): B(1) = Cmplx(0.1581, 0.1537): B(2) = Cmplx(0.1132, -0.229)
Call Zptsvx("N", N, D(), E(), Df(), Ef(), B(), X(), RCond, FErr(), BErr(), Info)
Debug.Print "X =",
Debug.Print Creal(X(0)), Cimag(X(0)), Creal(X(1)), Cimag(X(1)), Creal(X(2)), Cimag(X(2))
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
- Example Results
X = 0.59 -0.28 -0.2 -0.04 0.24 -0.49
RCond = 0.124521368143895
Info = 0
|