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

◆ Zpotri()

Sub Zpotri ( Uplo As  String,
N As  Long,
A() As  Complex,
Info As  Long 
)

Inverse of a Hermitian positive definite matrix

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