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

## Purpose

nag_det_withdraw_real_band_sym (f03ac) calculates the determinant of a real symmetric positive definite band matrix using a Cholesky factorization.
Note: this function is scheduled to be withdrawn, please see f03ac in Advice on Replacement Calls for Withdrawn/Superseded Routines..

## Syntax

[det, rl, ifail] = f03ac(a, m, 'n', n, 'm1', m1)
[det, rl, ifail] = nag_det_withdraw_real_band_sym(a, m, 'n', n, 'm1', m1)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 22: n has been made optional
.

## Description

The determinant of A$A$ is calculated using the Cholesky factorization A = LLT$A=L{L}^{\mathrm{T}}$, where L$L$ is a lower triangular band matrix. The determinant of A$A$ 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,m1) – double array
lda, the first dimension of the array, must satisfy the constraint ldan$\mathit{lda}\ge {\mathbf{n}}$.
The lower triangle of the n$n$ by n$n$ positive definite symmetric band matrix A$A$, with the diagonal of the matrix stored in the (m + 1)$\left(m+1\right)$th column of the array, and the m$m$ subdiagonals within the band stored in the first m$m$ columns of the array. Each row of the matrix is stored in the corresponding row of the array. For example, if n = 5$n=5$ and m = 2$m=2$, the storage scheme is
 * * a11 * a21 a22 a31 a32 a33 a42 a43 a44 a53 a54 a55
.
$* * a11 * a21 a22 a31 a32 a33 a42 a43 a44 a53 a54 a55 .$
The elements in the top left corner of the array are not used. The following code may be used to assign elements within the band of the lower triangle of the matrix to the correct elements of the array:
` for i=1:n for j=max(1,i-m):i a(i,j-i+m+1) = matrix(i,j); end end `
2:     m – int64int32nag_int scalar
m$m$, the number of subdiagonals within the band of A$A$.

### Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array a.
n$n$, the order of the matrix A$A$.
2:     m1 – int64int32nag_int scalar
Default: The second dimension of the array a.
The value m + 1$m+1$.

lda ldrl

### Output Parameters

1:     det – double scalar
The determinant of A$A$.
2:     rl(ldrl,m1) – double array
ldrln$\mathit{ldrl}\ge {\mathbf{n}}$.
The lower triangular matrix L$L$, stored in the same way as A$A$, except that in place of the diagonal elements, their reciprocals are stored.
3:     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.
ifail = 2${\mathbf{ifail}}=2$
Overflow. The value of the determinant is too large to be held in the computer.
ifail = 3${\mathbf{ifail}}=3$
Underflow. The value of the determinant is too small to be held in the computer.

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

The time taken by nag_det_withdraw_real_band_sym (f03ac) is approximately proportional to n(m + 1)2$n{\left(m+1\right)}^{2}$.
This function should only be used when mn$m\ll n$ since as m$m$ approaches n$n$, it becomes less efficient to take advantage of the band form.

## Example

```function nag_det_withdraw_real_band_sym_example
a = [0, 0, 5;
0, -4, 6;
1, -4, 6;
1, -4, 6;
1, -4, 6;
1, -4, 6;
1, -4, 5];
m = int64(2);
[det, rl, ifail] = nag_det_withdraw_real_band_sym(a, m)
```
```

det =

64.0000

rl =

0         0    0.4472
0   -1.7889    0.5976
0.4472   -1.9124    0.6831
0.5976   -1.9518    0.7385
0.6831   -1.9695    0.7774
0.7385   -1.9789    0.8062
0.7774   -1.9846    1.4790

ifail =

0

```
```function f03ac_example
a = [0, 0, 5;
0, -4, 6;
1, -4, 6;
1, -4, 6;
1, -4, 6;
1, -4, 6;
1, -4, 5];
m = int64(2);
[det, rl, ifail] = f03ac(a, m)
```
```

det =

64.0000

rl =

0         0    0.4472
0   -1.7889    0.5976
0.4472   -1.9124    0.6831
0.5976   -1.9518    0.7385
0.6831   -1.9695    0.7774
0.7385   -1.9789    0.8062
0.7774   -1.9846    1.4790

ifail =

0

```