|
|
◆ Dpotrf()
| Sub Dpotrf |
( |
Uplo As |
String, |
|
|
N As |
Long, |
|
|
A() As |
Double, |
|
|
Info As |
Long |
|
) |
| |
Cholesky factorization of a symmetric positive definite matrix
- Purpose
- This routine computes the Cholesky factorization of a real symmetric positive definite matrix A. The factorization has the form
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.
This is the blocked version of the algorithm, calling Level 3 BLAS.
- Parameters
-
| [in] | Uplo | = "U": Upper triangle of A is stored.
= "L": Lower triangle of A is stored. |
| [in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in,out] | A() | Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
[in] N x N symmetric positive definite matrix A. The upper or lower triangular part is to be referenced 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. |
| [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 A() is invalid.
= i > 0: The leading minor of order i is not positive definite, and the factorization could not be completed. |
- 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_Dpotrf()
Const N = 3
Dim A(N - 1, N - 1) As Double, B(N - 1) As Double
Dim ANorm As Double, RCond As Double, Info As Long
A(0, 0) = 2.2
A(1, 0) = -0.11: A(1, 1) = 2.93
A(2, 0) = -0.32: A(2, 1) = 0.81: A(2, 2) = 2.37:
B(0) = -1.566: B(1) = -2.8425: B(2) = -1.1765
ANorm = Dlansy("1", "L", N, A())
Call Dpotrf("L", N, A(), Info)
If Info = 0 Then Call Dpotrs("L", N, A(), B(), Info)
If Info = 0 Then Call Dpocon("L", N, A(), ANorm, RCond, Info)
Debug.Print "X =", B(0), B(1), B(2)
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Function Dlansy(Norm As String, Byval Uplo As String, N As Long, A() As Double, Optional Info As Long) As Double One norm, Frobenius norm, infinity norm, or largest absolute value of any element of a real symmetric...
Sub Dpocon(Uplo As String, N As Long, A() As Double, ANorm As Double, RCond As Double, Info As Long) Condition number of a symmetric positive definite matrix
Sub Dpotrs(Uplo As String, N As Long, A() As Double, B() As Double, Info As Long, Optional Nrhs As Long=1) Solution to factorized system of linear equations AX = B for a symmetric positive definite matrix
Sub Dpotrf(Uplo As String, N As Long, A() As Double, Info As Long) Cholesky factorization of a symmetric positive definite matrix
- Example Results
X = -0.8 -0.92 -0.29
RCond = 0.446791078068956
Info = 0
|