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

◆ Zhptri()

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

Inverse of a Hermitian matrix in packed form

Purpose
This routine computes the inverse of a Hermitian indefinite matrix A in packed form using the factorization A = U*D*U^H or A = L*D*L^H computed by Zhptrf.
Parameters
[in]UploSpecifies whether the details of the factorization are stored as an upper or lower triangular matrix.
= "U": Upper triangular, form is A = U*D*U^H.
= "L": Lower triangular, form is A = L*D*L^H.
[in]NOrder of the matrix A. (N >= 0) (If N = 0, returns without computation)
[in,out]Ap()Array Ap(LAp - 1) (LAp >= N(N + 1)/2)
[in] The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by Zhptrf, stored as a packed triangular matrix.
[out] If Info = 0, the (symmetric) inverse of the original matrix, stored as a packed triangular matrix. The upper or lower triangular part of the inverse is stored in accordance with Uplo.
[in]IPiv()Array IPiv(LIPiv - 1) (LIPiv >= N)
Details of the interchanges and the block structure of D as determined by Zhptrf.
[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.
= -4: The argument IPiv() is invalid.
= i > 0: The i-th element of D is exactly zero; the matrix is singular and its inverse could not be computed.
Reference
LAPACK
Example Program
Compute the inverse matrix of A, where
( 0.20 -0.11+0.93i 0.81-0.37i )
A = ( -0.11-0.93i -0.32 -0.80+0.92i )
( 0.81+0.37i -0.80-0.92i -0.29 )
Sub Ex_Zhptri()
Const N = 3
Dim Ap(N * (N + 1) / 2) As Complex, IPiv(N - 1) As Long, Info As Long
Ap(0) = Cmplx(0.2, 0)
Ap(1) = Cmplx(-0.11, -0.93): Ap(3) = Cmplx(-0.32, 0)
Ap(2) = Cmplx(0.81, 0.37): Ap(4) = Cmplx(-0.8, -0.92): Ap(5) = Cmplx(-0.29, 0)
Call Zhptrf("L", N, Ap(), IPiv(), Info)
If Info = 0 Then Call Zhptri("L", N, Ap(), IPiv(), 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) =
3.5853396244861 0
2.62494404338631 -0.461802857775011 2.18938290789155 0
1.30796976541958 -2.47907094012256 0.702866522251437 -2.3066988427915
2.42092751624671 0
Info = 0