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_band_sym (f03bh)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_det_real_band_sym (f03bh) computes the determinant of a n by n symmetric positive definite banded matrix A 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

[d, id, ifail] = f03bh(uplo, kd, ab, 'n', n)
[d, id, ifail] = nag_det_real_band_sym(uplo, kd, ab, 'n', n)

Description

The determinant of A is calculated using the Cholesky factorization A=UTU, where U is an upper triangular band matrix, or A=LLT, where L is a lower triangular band matrix. The determinant of A is the product of the squares of the diagonal elements of U or L.

References

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

Parameters

Compulsory Input Parameters

1:     uplo – string (length ≥ 1)
Indicates whether the upper or lower triangular part of A was stored and how it was factorized. This should not be altered following a call to nag_lapack_dpbtrf (f07hd).
uplo='U'
The upper triangular part of A was originally stored and A was factorized as UTU where U is upper triangular.
uplo='L'
The lower triangular part of A was originally stored and A was factorized as LLT where L is lower triangular.
Constraint: uplo='U' or 'L'.
2:     kd int64int32nag_int scalar
kd, the number of superdiagonals or subdiagonals of the matrix A.
Constraint: kd0.
3:     abldab: – double array
The first dimension of the array ab must be at least kd+1.
The second dimension of the array ab must be at least max1,n.
The Cholesky factor of A, as returned by nag_lapack_dpbtrf (f07hd).

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the second dimension of the array ab.
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: uplo='L' or 'U'.
   ifail=2
Constraint: n>0.
   ifail=3
Constraint: kd0.
   ifail=5
Constraint: ldabkd+1.
   ifail=6
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 54 of Wilkinson and Reinsch (1971).

Further Comments

The time taken by nag_det_real_band_sym (f03bh) is approximately proportional to n.
This function should only be used when mn since as m approaches n, 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
5 -4 1 -4 6 -4 1 1 -4 6 -4 1 1 -4 6 -4 1 1 -4 6 -4 1 1 -4 6 -4 1 -4 5 .  
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];
% Factorize a
[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)
Chapter Contents
Chapter Introduction
NAG Toolbox

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