|
|
◆ Dpotri()
| Sub Dpotri |
( |
Uplo As |
String, |
|
|
N As |
Long, |
|
|
A() As |
Double, |
|
|
Info As |
Long |
|
) |
| |
Inverse of a symmetric positive definite matrix
- Purpose
- This routine computes the inverse of a real symmetric positive definite matrix A using the Cholesky factorization A = U^T*U or A = L*L^T computed by dpotrf.
- Parameters
-
| [in] | Uplo | = "U": Upper triangular factor U is stored in A().
= "L": Lower triangular factor L is stored in A(). |
| [in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in] | A() | Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
[in] The triangular factor U or L from the Cholesky factorization A = U^T*U or A = L*L^T, as computed by Dpotrf.
[out] If Info = 0, the upper or lower triangle of the (symmetric) inverse of A, overwriting the input factor U or L. |
| [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 i-th diagonal element of the factor U or L is zero, and the inverse could not be computed. |
- Reference
- LAPACK
- Example Program
- Compute the inverse matrix of A, where A is symmetric positive definite and
( 2.2 -0.11 -0.32 )
A = ( -0.11 2.93 0.81 )
( -0.32 0.81 2.37 )
Sub Ex_Dpotri()
Const N = 3
Dim A(N - 1, N - 1) 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:
Call Dpotrf("L", N, A(), Info)
If Info = 0 Then Call Dpotri("L", N, A(), Info)
Debug.Print "Inv(A) ="
Debug.Print A(0, 0), A(0, 1), A(0, 2)
Debug.Print A(1, 0), A(1, 1), A(1, 2)
Debug.Print A(2, 0), A(2, 1), A(2, 2)
Debug.Print "Info =", Info
End Sub
Sub Dpotri(Uplo As String, N As Long, A() As Double, Info As Long) Inverse of 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
Inv(A) =
0.463651335375572 0 0
1.10603849087679E-04 0.376908423331071 0
6.25649106339333E-02 -0.128801869057578 0.474409403096834
Info = 0
|