# NAG CL Interfacef03bfc (real_​sym)

Settings help

CL Name Style:

## 1Purpose

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

## 2Specification

 #include
 void f03bfc (Nag_OrderType order, Integer n, const double a[], Integer pda, double *d, Integer *id, NagError *fail)
The function may be called by the names: f03bfc or nag_det_real_sym.

## 3Description

f03bfc computes the determinant of a real $n×n$ symmetric positive definite matrix $A$ that has been factorized as $A={U}^{\mathrm{T}}U$, where $U$ is upper triangular, or $A=L{L}^{\mathrm{T}}$, 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 f07fdc.
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

## 5Arguments

1: $\mathbf{order}$Nag_OrderType Input
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.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}>0$.
3: $\mathbf{a}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array a must be at least ${\mathbf{pda}}×{\mathbf{n}}$.
the $\left(i,j\right)$th element of the Cholesky factorization of the matrix $A$ is stored in
• ${\mathbf{a}}\left[\left(j-1\right)×{\mathbf{pda}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{a}}\left[\left(i-1\right)×{\mathbf{pda}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the lower or upper triangle of the Cholesky factorized form of the $n×n$ positive definite symmetric matrix $A$. Only the diagonal elements are referenced.
4: $\mathbf{pda}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint: ${\mathbf{pda}}\ge {\mathbf{n}}$.
5: $\mathbf{d}$double * Output
6: $\mathbf{id}$Integer * 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.
7: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}>0$.
NE_INT_2
On entry, ${\mathbf{pda}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pda}}\ge {\mathbf{n}}$.
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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_MAT_NOT_POS_DEF
The matrix $A$ is not positive definite.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

## 7Accuracy

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

## 8Parallelism and Performance

f03bfc is not threaded in any implementation.

The time taken by f03bfc is approximately proportional to $n$.

## 10Example

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

### 10.1Program Text

Program Text (f03bfce.c)

### 10.2Program Data

Program Data (f03bfce.d)

### 10.3Program Results

Program Results (f03bfce.r)