PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_det_real_band_sym (f03bh)
Purpose
nag_det_real_band_sym (f03bh) computes the determinant of a
by
symmetric positive definite banded matrix
that has been stored in band-symmetric storage.
nag_lapack_dpbtrf (f07hd) must be called first to supply the Cholesky factorized form. The storage (upper or lower triangular) used by
nag_lapack_dpbtrf (f07hd) is relevant as this determines which elements of the stored factorized form are referenced.
Syntax
Description
The determinant of is calculated using the Cholesky factorization , where is an upper triangular band matrix, or , where is a lower triangular band matrix. The determinant of is the product of the squares of the diagonal elements of or .
References
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag
Parameters
Compulsory Input Parameters
- 1:
– string (length ≥ 1)
-
Indicates whether the upper or lower triangular part of
was stored and how it was factorized. This should not be altered following a call to
nag_lapack_dpbtrf (f07hd).
- The upper triangular part of was originally stored and was factorized as where is upper triangular.
- The lower triangular part of was originally stored and was factorized as where is lower triangular.
Constraint:
or .
- 2:
– int64int32nag_int scalar
-
, the number of superdiagonals or subdiagonals of the matrix .
Constraint:
.
- 3:
– double array
-
The first dimension of the array
ab must be at least
.
The second dimension of the array
ab must be at least
.
The Cholesky factor of
, as returned by
nag_lapack_dpbtrf (f07hd).
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
ab.
, the order of the matrix .
Constraint:
.
Output Parameters
- 1:
– double scalar
- 2:
– int64int32nag_int scalar
-
The determinant of is given by . It is given in this form to avoid overflow or underflow.
- 3:
– 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:
-
-
Constraint: or .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
The matrix is not positive definite.
-
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 determinant depends on the conditioning of the original matrix. For a detailed error analysis see page 54 of
Wilkinson and Reinsch (1971).
Further Comments
The time taken by nag_det_real_band_sym (f03bh) is approximately proportional to .
This function should only be used when since as approaches , it becomes less efficient to take advantage of the band form.
Example
This example calculates the determinant of the real symmetric positive definite band matrix
Open in the MATLAB editor:
f03bh_example
function f03bh_example
fprintf('f03bh example results\n\n');
uplo = 'l';
kd = int64(2);
n = int64(7);
ab = [ 5, 6, 6, 6, 6, 6, 5;
-4, -4, -4, -4, -4, -4, 0;
1, 1, 1, 1, 1, 0, 0];
[ab, info] = f07hd(uplo, kd, ab);
if info == 0
fprintf('\n');
[ifail] = x04ce(n, n, kd, int64(0), ab, 'Array ab after factorization');
[d, id, ifail] = f03bh(uplo, kd, ab);
fprintf('d = %13.5f id = %d\n', d, id);
fprintf('Value of determinant = %13.5e\n', d*2^id);
else
fprintf('\n** Factorization routine returned error flag info = %d\n', info);
end
f03bh example results
Array ab after factorization
1 2 3 4 5 6 7
1 2.2361
2 -1.7889 1.6733
3 0.4472 -1.9124 1.4639
4 0.5976 -1.9518 1.3540
5 0.6831 -1.9695 1.2863
6 0.7385 -1.9789 1.2403
7 0.7774 -1.9846 0.6761
d = 0.25000 id = 8
Value of determinant = 6.40000e+01
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015