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

◆ Dtrtri()

Sub Dtrtri ( Uplo As  String,
Diag As  String,
N As  Long,
A() As  Double,
Info As  Long 
)

Inverse of a triangular matrix

Purpose
This routine computes the inverse of a real 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
( -1.13 0 0 )
A = ( 0.26 -1.98 0 )
( -0.96 0.30 -2.32 )
Sub Ex_Dtrtri()
Const N = 3
Dim A(N - 1, N - 1) As Double, Info As Long
A(0, 0) = -1.13
A(1, 0) = 0.26: A(1, 1) = -1.98
A(2, 0) = -0.96: A(2, 1) = 0.3: A(2, 2) = -2.32
Call Dtrtri("L", "N", N, A(), Info)
Debug.Print "Inv(A) ="
Debug.Print A(0, 0), A(0, 1), A(0, 2)
Debug.Print A(1, 0), A(1, 1), A(1, 2)
Debug.Print A(2, 0), A(2, 1), A(2, 2)
Debug.Print "Info =", Info
End Sub
Example Results
Inv(A) =
-0.884955752212389 0 0
-0.116206310896576 -0.505050505050505 0
0.35116190898919 -6.53082549634274E-02 -0.431034482758621
Info = 0