nag_real_cholesky (f03aec) (PDF version)
f03 Chapter Contents
f03 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_real_cholesky (f03aec)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_real_cholesky (f03aec) computes a Cholesky factorization of a real symmetric positive definite matrix, and evaluates the determinant.

2  Specification

#include <nag.h>
#include <nagf03.h>
void  nag_real_cholesky (Integer n, double a[], Integer tda, double p[], double *detf, Integer *dete, NagError *fail)

3  Description

nag_real_cholesky (f03aec) computes the Cholesky factorization of a real symmetric positive definite matrix A = LLT  where L  is lower triangular. The determinant is the product of the squares of the diagonal elements of L .

4  References

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

5  Arguments

1:     nIntegerInput
On entry: n , the order of the matrix A .
Constraint: n1 .
2:     a[n×tda]doubleInput/Output
Note: the i,jth element of the matrix A is stored in a[i-1×tda+j-1].
On entry: the upper triangle of the n  by n  positive definite symmetric matrix A . The elements of the array below the diagonal need not be set.
On exit: the sub-diagonal elements of the lower triangular matrix L . The upper triangle of A  is unchanged.
3:     tdaIntegerInput
On entry: the stride separating matrix column elements in the array a.
Constraint: tdan .
4:     p[n]doubleOutput
On exit: the reciprocals of the diagonal elements of L .
5:     detfdouble *Output
6:     deteInteger *Output
On exit: the determinant of A  is given by detf × 2.0 dete . 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_2_INT_ARG_LT
On entry, tda=value  while n=value . These arguments must satisfy tdan .
NE_INT_ARG_LT
On entry, n=value.
Constraint: n1.
NE_NOT_POS_DEF
The matrix is not positive definite, possibly due to rounding errors. The factorization could not be completed. detf and dete are set to zero.

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_real_cholesky (f03aec) is approximately proportional to n 3 .

9  Example

To compute a Cholesky factorization and calculate 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 (f03aece.c)

9.2  Program Data

Program Data (f03aece.d)

9.3  Program Results

Program Results (f03aece.r)


nag_real_cholesky (f03aec) (PDF version)
f03 Chapter Contents
f03 Chapter Introduction
NAG C Library Manual

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