hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_det_real_sym (f03bf)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_det_real_sym (f03bf) computes the determinant of a real n by n symmetric positive definite matrix A. nag_lapack_dpotrf (f07fd) must be called first to supply the symmetric matrix A in Cholesky factorized form. The storage (upper or lower triangular) used by nag_lapack_dpotrf (f07fd) is not relevant to nag_det_real_sym (f03bf) since only the diagonal elements of the factorized A are referenced.

Syntax

[d, id, ifail] = f03bf(a, 'n', n)
[d, id, ifail] = nag_det_real_sym(a, 'n', n)

Description

nag_det_real_sym (f03bf) computes the determinant of a real n by n symmetric positive definite matrix A that has been factorized as A=UTU, where U is upper triangular, or A=LLT, where L is lower triangular. The determinant is the product of the squares of the diagonal elements of U or L. The Cholesky factorized form of the matrix must be supplied; this is returned by a call to nag_lapack_dpotrf (f07fd).

References

Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

Parameters

Compulsory Input Parameters

1:     alda: – double array
The first dimension of the array a must be at least n.
The second dimension of the array a must be at least n.
The lower or upper triangle of the Cholesky factorized form of the n by n positive definite symmetric matrix A. Only the diagonal elements are referenced.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array a.
n, the order of the matrix A.
Constraint: n>0.

Output Parameters

1:     d – double scalar
2:     id int64int32nag_int scalar
The determinant of A is given by d×2.0id. It is given in this form to avoid overflow or underflow.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
Constraint: n>0.
   ifail=3
Constraint: ldan.
   ifail=4
The matrix A is not positive definite.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
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 25 of Wilkinson and Reinsch (1971).

Further Comments

The time taken by nag_det_real_sym (f03bf) is approximately proportional to n.

Example

This example computes a Cholesky factorization and calculates the determinant of the real symmetric positive definite matrix
6 7 6 5 7 11 8 7 6 8 11 9 5 7 9 11 .  
function f03bf_example


fprintf('f03bf example results\n\n');

a = [6,   7,   6,   5;
     7,  11,   8,   7;
     6,   8,  11,   9;
     5,   7,   9,  11];
% Factorize a
[a, info] = f07fd('l', a);

fprintf('\n');
[ifail] = x04ca('l', 'n', a, 'Array a after factorization');

[d, id, ifail] = f03bf(a);

fprintf('\nd = %13.5f id = %d\n', d, id);
fprintf('Value of determinant = %13.5e\n', d*2^id);


f03bf example results


 Array a after factorization
             1          2          3          4
 1      2.4495
 2      2.8577     1.6833
 3      2.4495     0.5941     2.1557
 4      2.0412     0.6931     1.6645     1.8927

d =       0.06909 id = 12
Value of determinant =   2.83000e+02

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015