Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_det_withdraw_real_sym_fac (f03ae)

Purpose

nag_det_withdraw_real_sym_fac (f03ae) computes a Cholesky factorization of a real symmetric positive definite matrix, and evaluates the determinant.
Note: this function is scheduled to be withdrawn, please see f03ae in Advice on Replacement Calls for Withdrawn/Superseded Routines..

Syntax

[a, p, d1, id, ifail] = f03ae(a, 'n', n)
[a, p, d1, id, ifail] = nag_det_withdraw_real_sym_fac(a, 'n', n)

Description

nag_det_withdraw_real_sym_fac (f03ae) computes the Cholesky factorization of a real symmetric positive definite matrix A = LLT$A=L{L}^{\mathrm{T}}$ where L$L$ is lower triangular. The determinant is the product of the squares of the diagonal elements of L$L$.

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 max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The upper triangle of the n$n$ by n$n$ positive definite symmetric matrix A$A$. The elements of the array below the diagonal need not be set.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array a The second dimension of the array a.
n$n$, the order of the matrix A$A$.
Constraint: n0${\mathbf{n}}\ge 0$.

lda

Output Parameters

1:     a(lda, : $:$) – double array
The first dimension of the array a will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldamax (1,n)$\mathit{lda}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The subdiagonal elements of the lower triangular matrix L$L$. The upper triangle of A$A$ is unchanged.
2:     p(n) – double array
The reciprocals of the diagonal elements of L$L$.
3:     d1 – double scalar
4:     id – int64int32nag_int scalar
The determinant of A$A$ is given by d1 × 2.0id${\mathbf{d1}}×{2.0}^{{\mathbf{id}}}$. It is given in this form to avoid overflow or underflow.
5:     ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{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${\mathbf{ifail}}=1$
The matrix A$A$ is not positive definite, possibly due to rounding errors. The factorization could not be completed. d1 and id are set to zero.
ifail = 2${\mathbf{ifail}}=2$
 On entry, n < 0${\mathbf{n}}<0$, or lda < max (1,n)$\mathit{lda}<\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.

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

The time taken by nag_det_withdraw_real_sym_fac (f03ae) is approximately proportional to n3${n}^{3}$.

Example

function nag_det_withdraw_real_sym_fac_example
a = [6, 7, 6, 5;
7, 11, 8, 7;
6, 8, 11, 9;
5, 7, 9, 11];
[aOut, p, d1, id, ifail] = nag_det_withdraw_real_sym_fac(a)

aOut =

6.0000    7.0000    6.0000    5.0000
2.8577   11.0000    8.0000    7.0000
2.4495    0.5941   11.0000    9.0000
2.0412    0.6931    1.6645   11.0000

p =

0.4082
0.5941
0.4639
0.5283

d1 =

0.0691

id =

12

ifail =

0

function f03ae_example
a = [6, 7, 6, 5;
7, 11, 8, 7;
6, 8, 11, 9;
5, 7, 9, 11];
[aOut, p, d1, id, ifail] = f03ae(a)

aOut =

6.0000    7.0000    6.0000    5.0000
2.8577   11.0000    8.0000    7.0000
2.4495    0.5941   11.0000    9.0000
2.0412    0.6931    1.6645   11.0000

p =

0.4082
0.5941
0.4639
0.5283

d1 =

0.0691

id =

12

ifail =

0