# NAG CL Interfacef03bnc (complex_​gen)

Settings help

CL Name Style:

## 1Purpose

f03bnc computes the determinant of a complex $n×n$ matrix $A$. f07arc must be called first to supply the matrix $A$ in factorized form.

## 2Specification

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

## 3Description

f03bnc computes the determinant of a complex $n×n$ matrix $A$ that has been factorized by a call to f07arc. The determinant of $A$ is the product of the diagonal elements of $U$ with the correct sign determined by the row interchanges.

## 4References

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 Complex 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 factorized form 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 $n×n$ matrix $A$ in factorized form as returned by f07arc.
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{ipiv}\left[{\mathbf{n}}\right]$const Integer Input
On entry: the row interchanges used to factorize matrix $A$ as returned by f07arc.
6: $\mathbf{d}$Complex * Output
On exit: the mantissa of the real and imaginary parts of the determinant.
7: $\mathbf{id}\left[2\right]$Integer Output
On exit: the exponents for the real and imaginary parts of the determinant. The determinant, $d=\left({d}_{r},{d}_{i}\right)$, is returned as ${d}_{r}={D}_{r}×{2}^{j}$ and ${d}_{i}={D}_{i}×{2}^{k}$, where ${\mathbf{d}}=\left({D}_{r},{D}_{i}\right)$ and $j$ and $k$ are stored in the first and second elements respectively of the array id on successful exit.
8: $\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}}\ge 1$.
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_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.
NE_SINGULAR
The matrix $A$ is approximately singular.

## 7Accuracy

The accuracy of the determinant depends on the conditioning of the original matrix. For a detailed error analysis, see page 107 of Wilkinson and Reinsch (1971).

## 8Parallelism and Performance

f03bnc is not threaded in any implementation.

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

## 10Example

This example calculates the determinant of the complex matrix
 $( 1 1+2i 2+10i 1+i 3i −5+14i 1+i 5i −8+20i ) .$

### 10.1Program Text

Program Text (f03bnce.c)

### 10.2Program Data

Program Data (f03bnce.d)

### 10.3Program Results

Program Results (f03bnce.r)