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)

Purpose

nag_det_real_sym (f03bf) computes the determinant of a real nn by nn symmetric positive definite matrix AA. nag_lapack_dpotrf (f07fd) must be called first to supply the symmetric matrix AA 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 AA 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 nn by nn symmetric positive definite matrix AA that has been factorized as A = UTUA=UTU, where UU is upper triangular, or A = LLTA=LLT, where LL is lower triangular. The determinant is the product of the squares of the diagonal elements of UU or LL. 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:     a(lda, : :) – double array
The first dimension of the array a must be at least nn
The second dimension of the array must be at least nn
The lower or upper triangle of the Cholesky factorized form of the nn by nn positive definite symmetric matrix AA. Only the diagonal elements are referenced.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array a.
nn, the order of the matrix AA.
Constraint: n > 0n>0.

Input Parameters Omitted from the MATLAB Interface

lda

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
Constraint: n > 0n>0.
  ifail = 3ifail=3
Constraint: ldanldan.
  ifail = 4ifail=4
The matrix AA is not positive definite.

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 nn.

Example

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

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

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

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

 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

function f03bf_example
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);
 

 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–2013