Integer type:** int32**** int64**** nag_int** show int32 show int32 show int64 show int64 show nag_int show nag_int

nag_det_withdraw_real_band_sym (f03ac) calculates the determinant of a real symmetric positive definite band matrix using a Cholesky factorization.

Mark 22: n has been made optional

.The determinant of A$A$ is calculated using the Cholesky factorization A = LL^{T}$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$.

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

- 1: a(lda,m1) – double array
- lda, the first dimension of the array, must satisfy the constraint lda ≥ n$\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)$(m+1)$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 isThe 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:

.* * a11 * a21 a22 a31 a32 a33 a42 a43 a44 a53 a54 a55 $$\left(\begin{array}{lll}\text{*}& \text{*}& {a}_{11}\\ \text{*}& {a}_{21}& {a}_{22}\\ {a}_{31}& {a}_{32}& {a}_{33}\\ {a}_{42}& {a}_{43}& {a}_{44}\\ {a}_{53}& {a}_{54}& {a}_{55}\end{array}\right)\text{.}$$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$.

- 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

- 1: det – double scalar
- The determinant of A$A$.
- 2: rl(ldrl,m1) – double array
- ldrl ≥ n$\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
- ifail = 0${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).

Errors or warnings detected by the function:

- The matrix A$A$ is not positive definite, possibly due to rounding errors.

- Overflow. The value of the determinant is too large to be held in the computer.

- Underflow. The value of the determinant is too small to be held in the computer.

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{(m+1)}^{2}$.

This function should only be used when m ≪ n$m\ll n$ since as m$m$ approaches n$n$, it becomes less efficient to take advantage of the band form.

Open in the MATLAB editor: nag_det_withdraw_real_band_sym_example

function nag_det_withdraw_real_band_sym_examplea = [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

Open in the MATLAB editor: f03ac_example

function f03ac_examplea = [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

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013