PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_matop_real_symm_posdef_inv_noref (f01ad)
Purpose
nag_matop_real_symm_posdef_inv_noref (f01ad) calculates the approximate inverse of a real symmetric positive definite matrix, using a Cholesky factorization.
Syntax
[
a,
ifail] = nag_matop_real_symm_posdef_inv_noref(
a, 'n',
n)
Description
To compute the inverse of a real symmetric positive definite matrix , nag_matop_real_symm_posdef_inv_noref (f01ad) first computes a Cholesky factorization of as , where is lower triangular. It then computes and finally forms as the product .
References
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag
Parameters
Compulsory Input Parameters
- 1:
– 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 upper triangle of the by positive definite symmetric matrix . The elements of the array below the diagonal need not be set.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
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
.
The lower triangle of the inverse matrix is stored in the elements of the array below the diagonal, in rows to ; is stored in for . The upper triangle of the original matrix is unchanged.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
The matrix is not positive definite, possibly due to rounding errors.
-
-
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The accuracy of the computed inverse depends on the conditioning of the original matrix. For a detailed error analysis see page 39 of
Wilkinson and Reinsch (1971).
Further Comments
The time taken by
nag_matop_real_symm_posdef_inv_noref (f01ad) is approximately proportional to
.
nag_matop_real_symm_posdef_inv_noref (f01ad) calls functions
nag_lapack_dpotrf (f07fd) and
nag_lapack_dpotri (f07fj) from LAPACK.
Example
This example finds the inverse of the
by
matrix:
Open in the MATLAB editor:
f01ad_example
function f01ad_example
fprintf('f01ad example results\n\n');
a = [ 5, 7, 6, 5;
7, 10, 8, 7;
6, 8, 10, 9;
5, 7, 9, 10];
a = [a; 0 0 0 0];
[X, ifail] = f01ad(a);
L = X(2:end,:);
matrix = 'Lower';
diag = 'Non-unit';
xtitl = 'Lower triangle of inverse:';
[ifail] = x04ca( ...
matrix, diag, L, xtitl);
f01ad example results
Lower triangle of inverse:
1 2 3 4
1 68.0000
2 -41.0000 25.0000
3 -17.0000 10.0000 5.0000
4 10.0000 -6.0000 -3.0000 2.0000
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015