XLPack 6.1
Excel VBA Numerical Library Reference Manual
Loading...
Searching...
No Matches

◆ Zpptri()

Sub Zpptri ( Uplo As  String,
N As  Long,
Ap() As  Complex,
Info As  Long 
)

Inverse of a Hermitian positive definite matrix in packed form

Purpose
This routine computes the inverse of a Hermitian positive definite matrix A in packed form using the Cholesky factorization A = U^H*U or A = L*L^H computed by zpptrf.
Parameters
[in]Uplo= "U": Upper triangular factor U is stored in Ap().
= "L": Lower triangular factor L is stored in Ap().
[in]NOrder 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^H*U or A = L*L^H, as computed by Zpptrf.
[out] If Info = 0, the upper or lower triangle of the (Hermitian) 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
( 2.20 -0.11+0.93i 0.81-0.37i )
A = ( -0.11-0.93i 2.32 -0.80+0.92i )
( 0.81+0.37i -0.80-0.92i 2.29 )
Sub Ex_Zpptri()
Const N = 3
Dim Ap(N * (N + 1) / 2) As Complex, Info As Long
Ap(0) = Cmplx(2.2, 0)
Ap(1) = Cmplx(-0.11, -0.93): Ap(3) = Cmplx(2.32, 0)
Ap(2) = Cmplx(0.81, 0.37): Ap(4) = Cmplx(-0.8, -0.92): Ap(5) = Cmplx(2.29, 0)
Call Zpptrf("L", N, Ap(), Info)
If Info = 0 Then Call Zpptri("L", N, Ap(), Info)
Debug.Print "Inv(A) ="
Debug.Print Creal(Ap(0)), Cimag(Ap(0))
Debug.Print Creal(Ap(1)), Cimag(Ap(1)), Creal(Ap(3)), Cimag(Ap(3))
Debug.Print Creal(Ap(2)), Cimag(Ap(2)), Creal(Ap(4)), Cimag(Ap(4))
Debug.Print Creal(Ap(5)), Cimag(Ap(5))
Debug.Print "Info =", Info
End Sub
Example Results
Inv(A) =
0.96823675342099 0
-0.186364825657161 0.652567887151733 1.07415978942926 0
-0.669749382959094 -3.34014351483294E-03 0.335735031475792 0.692472480506973
1.06960504827267 0
Info = 0