f03 Chapter Contents
f03 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_det_real_band_sym (f03bhc)

## 1  Purpose

nag_det_real_band_sym (f03bhc) computes the determinant of a $n$ by $n$ symmetric positive definite banded matrix $A$ that has been stored in band-symmetric storage. nag_dpbtrf (f07hdc) must be called first to supply the Cholesky factorized form. The storage (upper or lower triangular) used by nag_dpbtrf (f07hdc) is relevant as this determines which elements of the stored factorized form are referenced.

## 2  Specification

 #include #include
 void nag_det_real_band_sym (Nag_OrderType order, Nag_UploType uplo, Integer n, Integer kd, const double ab[], Integer pdab, double *d, Integer *id, NagError *fail)

## 3  Description

The determinant of $A$ is calculated using the Cholesky factorization $A={U}^{\mathrm{T}}U$, where $U$ is an upper triangular band matrix, or $A=L{L}^{\mathrm{T}}$, 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$.

## 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 ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or Nag_ColMajor.
2:     uploNag_UploTypeInput
On entry: 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_dpbtrf (f07hdc).
${\mathbf{uplo}}=\mathrm{Nag_Upper}$
The upper triangular part of $A$ was originally stored and $A$ was factorized as ${U}^{\mathrm{T}}U$ where $U$ is upper triangular.
${\mathbf{uplo}}=\mathrm{Nag_Lower}$
The lower triangular part of $A$ was originally stored and $A$ was factorized as $L{L}^{\mathrm{T}}$ where $L$ is lower triangular.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
3:     nIntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}>0$.
4:     kdIntegerInput
On entry: ${k}_{d}$, the number of superdiagonals or subdiagonals of the matrix $A$.
Constraint: ${\mathbf{kd}}\ge 0$.
5:     ab[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, of the array ab must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdab}}×{\mathbf{n}}\right)$.
On entry: the Cholesky factor of $A$, as returned by nag_dpbtrf (f07hdc).
6:     pdabIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) of the matrix in the array ab.
Constraint: ${\mathbf{pdab}}\ge {\mathbf{kd}}+1$.
7:     ddouble *Output
8:     idInteger *Output
On exit: the determinant of $A$ is given by ${\mathbf{d}}×{2.0}^{{\mathbf{id}}}$. It is given in this form to avoid overflow or underflow.
9:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{kd}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{kd}}\ge 0$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}>0$.
NE_INT_2
On entry, ${\mathbf{pdab}}=〈\mathit{\text{value}}〉$ and ${\mathbf{kd}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdab}}\ge {\mathbf{kd}}+1$.
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 54 of Wilkinson and Reinsch (1971).

The time taken by nag_det_real_band_sym (f03bhc) is approximately proportional to $n$.
This function should only be used when $m\ll n$ since as $m$ approaches $n$, it becomes less efficient to take advantage of the band form.

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

### 9.1  Program Text

Program Text (f03bhce.c)

### 9.2  Program Data

Program Data (f03bhce.d)

### 9.3  Program Results

Program Results (f03bhce.r)