PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dtrtri (f07tj)
Purpose
nag_lapack_dtrtri (f07tj) computes the inverse of a real triangular matrix.
Syntax
Description
nag_lapack_dtrtri (f07tj) forms the inverse of a real triangular matrix . Note that the inverse of an upper (lower) triangular matrix is also upper (lower) triangular.
References
Du Croz J J and Higham N J (1992) Stability of methods for matrix inversion IMA J. Numer. Anal. 12 1–19
Parameters
Compulsory Input Parameters
- 1:
– string (length ≥ 1)
-
Specifies whether
is upper or lower triangular.
- is upper triangular.
- is lower triangular.
Constraint:
or .
- 2:
– string (length ≥ 1)
-
Indicates whether
is a nonunit or unit triangular matrix.
- is a nonunit triangular matrix.
- is a unit triangular matrix; the diagonal elements are not referenced and are assumed to be .
Constraint:
or .
- 3:
– double array
-
The first dimension of the array
a must be at least
.
The second dimension of the array
a must be at least
.
The
by
triangular matrix
.
- If , is upper triangular and the elements of the array below the diagonal are not referenced.
- If , is lower triangular and the elements of the array above the diagonal are not referenced.
- If , the diagonal elements of are assumed to be , and are not referenced.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
a and the second dimension of the array
a.
, the order of the matrix .
Constraint:
.
Output Parameters
- 1:
– double array
-
The first dimension of the array
a will be
.
The second dimension of the array
a will be
.
stores , using the same storage format as described above.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
- W
-
Element of the diagonal is exactly zero.
is singular its inverse cannot be computed.
Accuracy
The computed inverse
satisfies
where
is a modest linear function of
, and
is the
machine precision.
Note that a similar bound for cannot be guaranteed, although it is almost always satisfied.
The computed inverse satisfies the forward error bound
See
Du Croz and Higham (1992).
Further Comments
The total number of floating-point operations is approximately .
The complex analogue of this function is
nag_lapack_ztrtri (f07tw).
Example
This example computes the inverse of the matrix
, where
Open in the MATLAB editor:
f07tj_example
function f07tj_example
fprintf('f07tj example results\n\n');
a = [ 4.30, 0, 0, 0;
-3.96, -4.87, 0, 0;
0.40, 0.31, -8.02, 0;
-0.27, 0.07, -5.95, 0.12];
uplo = 'L';
diag = 'N';
[ainv, info] = f07tj(uplo, diag, a);
[ifail] = x04ca( ...
uplo, diag, ainv, 'Inverse');
f07tj example results
Inverse
1 2 3 4
1 0.2326
2 -0.1891 -0.2053
3 0.0043 -0.0079 -0.1247
4 0.8463 -0.2738 -6.1825 8.3333
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015