|
|
◆ Dpptri()
| Sub Dpptri |
( |
Uplo As |
String, |
|
|
N As |
Long, |
|
|
Ap() As |
Double, |
|
|
Info As |
Long |
|
) |
| |
Inverse of a symmetric positive definite matrix in packed form
- Purpose
- This routine computes the inverse of a real symmetric positive definite matrix A in packed form using the Cholesky factorization A = U^T*U or A = L*L^T computed by Dpptrf.
- Parameters
-
| [in] | Uplo | = "U": Upper triangular factor U is stored in Ap().
= "L": Lower triangular factor L is stored in Ap(). |
| [in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in] | Ap() | Array Ap(LAp - 1) (LAp >= N(N + 1)/2)
[in] The triangular factor U or L in packed form from the Cholesky factorization A = U^T*U or A = L*L^T, as computed by Dpptrf.
[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 Ap() 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_Dpptri()
Const N = 3
Dim Ap(N * (N + 1) / 2) 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:
Call Dpptrf("L", N, Ap(), Info)
If Info = 0 Then Call Dpptri("L", N, Ap(), Info)
Debug.Print "Inv(A) ="
Debug.Print Ap(0)
Debug.Print Ap(1), Ap(3)
Debug.Print Ap(2), Ap(4), Ap(5)
Debug.Print "Info =", Info
End Sub
Sub Dpptrf(Uplo As String, N As Long, Ap() As Double, Info As Long) Cholesky factorization of a symmetric positive definite matrix
Sub Dpptri(Uplo As String, N As Long, Ap() As Double, Info As Long) Inverse of a symmetric positive definite matrix in packed form
- Example Results
Inv(A) =
0.463651335375572
1.10603849087679E-04 0.376908423331071
6.25649106339333E-02 -0.128801869057578 0.474409403096834
Info = 0
|