|
|
◆ Dppsv()
| Sub Dppsv |
( |
Uplo As |
String, |
|
|
N As |
Long, |
|
|
Ap() As |
Double, |
|
|
B() As |
Double, |
|
|
Info As |
Long, |
|
|
Optional Nrhs As |
Long = 1 |
|
) |
| |
(Simple driver) Solution to system of linear equations AX = B for a symmetric positive definite matrix in packed form
- Purpose
- This routine computes the solution to a real system of linear equations where A is an n x n symmetric positive definite matrix stored in packed form and X and B are n x nrhs matrices.
The Cholesky decomposition is used to factor A as A = U^T * U, if Uplo = "U", or
A = L * L^T, if Uplo = "L",
where U is an upper triangular matrix and L is a lower triangular matrix. The factored form of A is then used to solve the system of equations A * X = B.
- Parameters
-
| [in] | Uplo | = "U": Upper triangle of A is stored.
= "L": Lower triangle of A is stored. |
| [in] | N | Number of linear equations, i.e., order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in,out] | Ap() | Array Ap(LAp - 1) (LAp >= N(N + 1)/2)
[in] N x N symmetric positive definite matrix A in packed form. The upper or lower part is to be stored in accordance with Uplo.
[out] If Info = 0, the factor U or L from the Cholesky factorization A = U^T*U or A = L*L^T. |
| [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 N had an illegal value. (N < 0)
= -3: The argument Ap() is invalid.
= -4: The argument B() is invalid.
= -6: The argument Nrhs had an illegal value. (Nrhs < 0)
= i > 0: The leading minor of order i of A is not positive definite, so the factorization could not be completed, and the solution has 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 A is symmetric positive definite and
( 2.2 -0.11 -0.32 ) ( -1.566 )
A = ( -0.11 2.93 0.81 ), B = ( -2.8425 )
( -0.32 0.81 2.37 ) ( -1.1765 )
Sub Ex_Dppsv()
Const N As Long = 3
Dim Ap(N * (N + 1) / 2) As Double, B(N - 1) As Double
Dim ANorm As Double, RCond As Double, Info As Long
Ap(0) = 2.2
Ap(1) = -0.11: Ap(3) = 2.93
Ap(2) = -0.32: Ap(4) = 0.81: Ap(5) = 2.37:
B(0) = -1.566: B(1) = -2.8425: B(2) = -1.1765
ANorm = Dlansp("1", "L", N, Ap())
Call Dppsv("L", N, Ap(), B(), Info)
If Info = 0 Then Call Dppcon("L", N, Ap(), ANorm, RCond, Info)
Debug.Print "X =", B(0), B(1), B(2)
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Function Dlansp(Norm As String, Uplo As String, N As Long, Ap() As Double, Optional Info As Long) As Double One norm, Frobenius norm, infinity norm, or largest absolute value of any element of a symmetric matr...
Sub Dppcon(Uplo As String, N As Long, Ap() As Double, ANorm As Double, RCond As Double, Info As Long) Condition number of a symmetric positive definite matrix in packed form
Sub Dppsv(Uplo As String, N As Long, Ap() As Double, B() As Double, Info As Long, Optional Nrhs As Long=1) (Simple driver) Solution to system of linear equations AX = B for a symmetric positive definite matri...
- Example Results
X = -0.8 -0.92 -0.29
RCond = 0.446791078068956
Info = 0
|