|
|
◆ Dptsvx()
| Sub Dptsvx |
( |
Fact As |
String, |
|
|
N As |
Long, |
|
|
D() As |
Double, |
|
|
E() As |
Double, |
|
|
Df() As |
Double, |
|
|
Ef() As |
Double, |
|
|
B() As |
Double, |
|
|
X() As |
Double, |
|
|
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 symmetric positive definite tridiagonal matrix
- Purpose
- This routine uses the factorization A = L*D*L^T to compute the solution to a real system of linear equations where A is an n x n symmetric 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 symmetric positive definite tridiagonal matrix A. |
| [in] | E() | Array E(LE - 1) (LE >= N - 1)
N-1 sub-diagonal elements of the symmetric 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^T factorization of A, are to be stored.
[out] If Fact = "N", n diagonal elements of the diagonal matrix D from the L*D*L^T 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^T 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^T 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 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_Dptsvx()
Const N As Long = 3
Dim D(N - 1) As Double, E(N - 2) As Double, B(N - 1) As Double
Dim Df(N - 1) As Double, Ef(N - 2) As Double, X(N - 1) As Double
Dim FErr(0) As Double, BErr(0) As Double
Dim 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
Call Dptsvx("N", N, D(), E(), Df(), Ef(), B(), X(), RCond, FErr(), BErr(), Info)
Debug.Print "X =", X(0), X(1), X(2)
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Sub Dptsvx(Fact As String, N As Long, D() As Double, E() As Double, Df() As Double, Ef() As Double, B() As Double, X() As Double, 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 symmetric positive definite tridi...
- Example Results
X = -0.82 -0.94 0.74
RCond = 0.0437508336668
Info = 0
|