XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Ztptri()

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

Inverse of a complex triangular matrix in packed form

Purpose
This routine computes the inverse of a complex upper or lower triangular matrix A stored in packed form.
Parameters
[in]Uplo= "U": A is upper triangular.
= "L": A is lower triangular.
[in]Diag= "N": A is non-unit triangular.
= "U": A is unit triangular. (Diagonal elements of Ap() are not referenced and are assumed to be 1)
[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] N x N triangular matrix A in packed symmetric matrix form. Upper or lower part is to be stored in accordance with Uplo.
[out] The (triangular) inverse of the original matrix, in the same packed form.
[out]Info= 0: Successful exit.
= -1: The argument Uplo had an illegal value. (Uplo <> "U" nor "L")
= -2: The argument Diag had an illegal value. (Diag <> "N" nor "U")
= -3: The argument N had an illegal value. (N < 0)
= -4: The argument Ap() is invalid.
= i > 0: The i-th diagonal element of A is exactly zero. The triangular matrix is singular and its inverse can not be computed.
Reference
LAPACK
Example Program
Compute the inverse matrix of A, where
( 0.20-0.11i 0 0 )
A = ( -0.93-0.32i 0.81+0.37i 0 )
( -0.80-0.92i -0.29+0.86i 0.64+0.51i )
Sub Ex_Ztptri()
Const N = 3
Dim Ap(N * (N + 1) / 2) As Complex, 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 Ztptri("L", "N", 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
Function Cmplx(R As Double, Optional I As Double=0) As Complex
Building complex number
Function Cimag(A As Complex) As Double
Imaginary part of complex number
Function Creal(A As Complex) As Double
Real part of complex number
Sub Ztptri(Uplo As String, Diag As String, N As Long, Ap() As Complex, Info As Long)
Inverse of a complex triangular matrix in packed form
Example Results
Inv(A) =
3.83877159309021 2.11132437619962
4.44578642778825 1.9098735819418 1.02143757881463 -0.466582597730139
5.36621770339369 -1.22742914259824 -0.87238813712865 -0.888792689354233
0.955651784381066 -0.761535015678662
Info = 0