nag_det_real_sym (f03bfc) (PDF version)
f03 Chapter Contents
f03 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_det_real_sym (f03bfc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

#include <nag.h>
#include <nagf03.h>
void  nag_det_real_sym (Nag_OrderType order, Integer n, const double a[], Integer pda, double *d, Integer *id, NagError *fail)

3  Description

nag_det_real_sym (f03bfc) 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_dpotrf (f07fdc).

4  References

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

5  Arguments

1:     orderNag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     nIntegerInput
On entry: n, the order of the matrix A.
Constraint: n>0.
3:     a[dim]const doubleInput
Note: the dimension, dim, of the array a must be at least pda×n.
The i,jth element of the Cholesky factorization of the matrix A is stored in
  • a[j-1×pda+i-1] when order=Nag_ColMajor;
  • a[i-1×pda+j-1] when order=Nag_RowMajor.
On entry: 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.
4:     pdaIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint: pdan.
5:     ddouble *Output
6:     idInteger *Output
On exit: the determinant of A is given by d×2.0id. It is given in this form to avoid overflow or underflow.
7:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n>0.
NE_INT_2
On entry, pda=value and n=value.
Constraint: pdan.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_MAT_NOT_POS_DEF
The matrix A is not positive definite.

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

8  Further Comments

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

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

9.1  Program Text

Program Text (f03bfce.c)

9.2  Program Data

Program Data (f03bfce.d)

9.3  Program Results

Program Results (f03bfce.r)


nag_det_real_sym (f03bfc) (PDF version)
f03 Chapter Contents
f03 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012