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

◆ Ztrtri()

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

Inverse of a complex triangular matrix

Purpose
This routine computes the inverse of a complex upper or lower triangular matrix A.
This is the Level 3 BLAS version of the algorithm.
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 A() are not referenced and are assumed to be 1)
[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] N x N triangular matrix A. Only the upper or lower triangular part is to be referenced in accordance with Uplo.
[out] The (triangular) inverse of the original matrix.
[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 A() 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_Ztrtri()
Const N = 3
Dim A(N - 1, N - 1) As Complex, Info As Long
A(0, 0) = Cmplx(0.2, -0.11)
A(1, 0) = Cmplx(-0.93, -0.32): A(1, 1) = Cmplx(0.81, 0.37)
A(2, 0) = Cmplx(-0.8, -0.92): A(2, 1) = Cmplx(-0.29, 0.86): A(2, 2) = Cmplx(0.64, 0.51)
Call Ztrtri("L", "N", 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
Example Results
Inv(A) =
3.83877159309021 2.11132437619962 0 0
0 0
4.44578642778825 1.9098735819418 1.02143757881463 -0.466582597730139
0 0
5.36621770339369 -1.22742914259824 -0.87238813712865 -0.888792689354233
0.955651784381066 -0.761535015678662
Info = 0