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

◆ Zsptri()

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

Inverse of a complex symmetric matrix in packed form

Purpose
This routine computes the inverse of a complex symmetric indefinite matrix A in packed form using the factorization A = U*D*U^T or A = L*D*L^T computed by zsptrf.
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^T.
= "L": Lower triangular, form is A = L*D*L^T.
[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 Zsptrf, 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 Zsptrf.
[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.11i -0.93-0.32i -0.80-0.92i )
A = ( -0.93-0.32i 0.81+0.37i -0.29+0.86i )
( -0.80-0.92i -0.29+0.86i 0.64+0.51i )
Sub Ex_Zsptri()
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.11)
Ap(1) = Cmplx(-0.93, -0.32): Ap(3) = Cmplx(0.81, 0.37)
Ap(2) = Cmplx(-0.8, -0.92): Ap(4) = Cmplx(-0.29, 0.86): Ap(5) = Cmplx(0.64, 0.51)
Call Zsptrf("L", N, Ap(), IPiv(), Info)
If Info = 0 Then Call Zsptri("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) =
-0.719227845649432 2.10409854531818E-02
-0.530264806881645 0.461068985285655 0.415967871341667 0.574878197201315
-0.378362108041106 0.215383726745448 -0.459100384344751 -0.118538953519092
0.392991440632119 -2.46277479810784E-02
Info = 0