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_gen_fac (f03af)

Purpose

nag_det_withdraw_real_gen_fac (f03af) computes an LU$LU$ factorization of a real matrix, with partial pivoting, and evaluates the determinant.
Note: this function is scheduled to be withdrawn, please see f03af in Advice on Replacement Calls for Withdrawn/Superseded Routines..

Syntax

[a, d1, id, p, ifail] = f03af(eps, a, 'n', n)
[a, d1, id, p, ifail] = nag_det_withdraw_real_gen_fac(eps, a, 'n', n)

Description

nag_det_withdraw_real_gen_fac (f03af) computes an LU$LU$ factorization of a real matrix A$A$ with partial pivoting: PA = LU$PA=LU$, where p${\mathbf{p}}$ is a permutation matrix, L$L$ is lower triangular and U$U$ is unit upper triangular. The determinant of A$A$ is the product of the diagonal elements of L$L$ with the correct sign determined by the row interchanges.

References

Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

Parameters

Compulsory Input Parameters

1:     eps – double scalar
Is no longer required by nag_det_withdraw_real_gen_fac (f03af) but is retained for backwards compatibility.
2:     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 n$n$ by n$n$ matrix A$A$.

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)$.
A$A$ stores the lower triangular matrix L$L$ and the off-diagonal elements of the upper triangular matrix U$U$. The unit diagonal elements of U$U$ are not stored.
2:     d1 – double scalar
3:     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.
4:     p(n) – double array
p(i)${\mathbf{p}}\left(i\right)$ gives the row index of the i$i$th pivot.
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 singular, 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 107 of Wilkinson and Reinsch (1971).

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

Example

```function nag_det_withdraw_real_gen_fac_example
epsilon = 1.111307226797642e-16;
a = [33, 16, 72;
-24, -10, -57;
-8, -4, -17];
[aOut, d1, id, p, ifail] = nag_det_withdraw_real_gen_fac(epsilon, a)
```
```

aOut =

-8.0000    0.5000    2.1250
-24.0000    2.0000   -3.0000
33.0000   -0.5000    0.3750

d1 =

0.3750

id =

4

p =

3
2
3

ifail =

0

```
```function f03af_example
epsilon = 1.111307226797642e-16;
a = [33, 16, 72;
-24, -10, -57;
-8, -4, -17];
[aOut, d1, id, p, ifail] = f03af(epsilon, a)
```
```

aOut =

-8.0000    0.5000    2.1250
-24.0000    2.0000   -3.0000
33.0000   -0.5000    0.3750

d1 =

0.3750

id =

4

p =

3
2
3

ifail =

0

```