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

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_sparse_direct_real_gen_diag (f11mm)

## Purpose

nag_sparse_direct_real_gen_diag (f11mm) computes the reciprocal pivot growth factor of an LU $LU$ factorization of a real sparse matrix in compressed column (Harwell–Boeing) format.

## Syntax

[rpg, ifail] = f11mm(n, icolzp, a, iprm, il, lval, iu, uval)
[rpg, ifail] = nag_sparse_direct_real_gen_diag(n, icolzp, a, iprm, il, lval, iu, uval)

## Description

nag_sparse_direct_real_gen_diag (f11mm) computes the reciprocal pivot growth factor maxj(Aj / Uj)${\mathrm{max}}_{j}\left({‖{A}_{j}‖}_{\infty }/{‖{U}_{j}‖}_{\infty }\right)$ from the columns Aj${A}_{j}$ and Uj${U}_{j}$ of an LU $LU$ factorization of the matrix A$A$, Pr A Pc = LU ${P}_{r}A{P}_{c}=LU$ where Pr${P}_{r}$ is a row permutation matrix, Pc${P}_{c}$ is a column permutation matrix, L$L$ is unit lower triangular and U$U$ is upper triangular as computed by nag_sparse_direct_real_gen_lu (f11me).

None.

## Parameters

### Compulsory Input Parameters

1:     n – int64int32nag_int scalar
n$n$, the order of the matrix A$A$.
Constraint: n0${\mathbf{n}}\ge 0$.
2:     icolzp( : $:$) – int64int32nag_int array
Note: the dimension of the array icolzp must be at least n + 1${\mathbf{n}}+1$.
icolzp(i)${\mathbf{icolzp}}\left(i\right)$ contains the index in A$A$ of the start of a new column. See Section [Compressed column storage (CCS) format] in the F11 Chapter Introduction.
3:     a( : $:$) – double array
Note: the dimension of the array a must be at least icolzp(n + 1)1${\mathbf{icolzp}}\left({\mathbf{n}}+1\right)-1$, the number of nonzeros of the sparse matrix A$A$.
The array of nonzero values in the sparse matrix A$A$.
4:     iprm(7 × n$7×{\mathbf{n}}$) – int64int32nag_int array
The column permutation which defines Pc${P}_{c}$, the row permutation which defines Pr${P}_{r}$, plus associated data structures as computed by nag_sparse_direct_real_gen_lu (f11me).
5:     il( : $:$) – int64int32nag_int array
Note: the dimension of the array il must be at least as large as the dimension of the array of the same name in nag_sparse_direct_real_gen_lu (f11me).
Records the sparsity pattern of matrix L$L$ as computed by nag_sparse_direct_real_gen_lu (f11me).
6:     lval( : $:$) – double array
Note: the dimension of the array lval must be at least as large as the dimension of the array of the same name in nag_sparse_direct_real_gen_lu (f11me).
Records the nonzero values of matrix L$L$ and some nonzero values of matrix U$U$ as computed by nag_sparse_direct_real_gen_lu (f11me).
7:     iu( : $:$) – int64int32nag_int array
Note: the dimension of the array iu must be at least as large as the dimension of the array of the same name in nag_sparse_direct_real_gen_lu (f11me).
Records the sparsity pattern of matrix U$U$ as computed by nag_sparse_direct_real_gen_lu (f11me).
8:     uval( : $:$) – double array
Note: the dimension of the array uval must be at least as large as the dimension of the array of the same name in nag_sparse_direct_real_gen_lu (f11me).
Records some nonzero values of matrix U$U$ as computed by nag_sparse_direct_real_gen_lu (f11me).

None.

None.

### Output Parameters

1:     rpg – double scalar
The reciprocal pivot growth factor maxj(Aj / Uj)${\mathrm{max}}_{j}\left({‖{A}_{j}‖}_{\infty }/{‖{U}_{j}‖}_{\infty }\right)$. If the reciprocal pivot growth factor is much less than 1$1$, the stability of the LU$LU$ factorization may be poor.
2:     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$
 On entry, n < 0${\mathbf{n}}<0$.
ifail = 2${\mathbf{ifail}}=2$
Ill-defined column permutations in array iprm${\mathbf{iprm}}$. Internal checks have revealed that the iprm${\mathbf{iprm}}$ array is corrupted.
ifail = 301${\mathbf{ifail}}=301$
Unable to allocate required internal workspace.

Not applicable.

## Further Comments

If the reciprocal pivot growth factor, rpg, is much less than 1$1$, then the factorization of the matrix A$A$ could be poor. This means that using the factorization to obtain solutions to a linear system, forward error bounds and estimates of the condition number could be unreliable. Consider increasing the thresh parameter in the call to nag_sparse_direct_real_gen_lu (f11me).

## Example

```function nag_sparse_direct_real_gen_diag_example
n = int64(5);
nz = int64(11);
icolzp = [int64(1); 3; 5; 7; 9; 12];
irowix = [int64(1); 3; 1; 5; 2; 3; 2; 4; 3; 4; 5];
a = [2; 4; 1; -2; 1; 1; -1; 1; 1; 2; 3];
iprm = zeros(1, 7*n, 'int64');
spec = 'M';
thresh = 1;
nzlmx = int64(8*nz);
nzlumx = int64(8*nz);
nzumx = int64(8*nz);

% Calculate COLAMD permutation
[iprm, ifail] = nag_sparse_direct_real_gen_setup(spec, n, icolzp, irowix, iprm);

% Factorise
[iprm, nzlumx, il, lval, iu, uval, nnzl, nnzu, flop, ifail] = ...
nag_sparse_direct_real_gen_lu(n, irowix, a, iprm, thresh, nzlmx, nzlumx, nzumx);

% Calculate reciprocal pivot growth
[rpg, ifail] = nag_sparse_direct_real_gen_diag(n, icolzp, a, iprm, il, lval, iu, uval)
```
```

rpg =

1

ifail =

0

```
```function f11mm_example
n = int64(5);
nz = int64(11);
icolzp = [int64(1); 3; 5; 7; 9; 12];
irowix = [int64(1); 3; 1; 5; 2; 3; 2; 4; 3; 4; 5];
a = [2; 4; 1; -2; 1; 1; -1; 1; 1; 2; 3];
iprm = zeros(1, 7*n, 'int64');
spec = 'M';
thresh = 1;
nzlmx = int64(8*nz);
nzlumx = int64(8*nz);
nzumx = int64(8*nz);

% Calculate COLAMD permutation
[iprm, ifail] = f11md(spec, n, icolzp, irowix, iprm);

% Factorise
[iprm, nzlumx, il, lval, iu, uval, nnzl, nnzu, flop, ifail] = ...
f11me(n, irowix, a, iprm, thresh, nzlmx, nzlumx, nzumx);

% Calculate reciprocal pivot growth
[rpg, ifail] = f11mm(n, icolzp, a, iprm, il, lval, iu, uval)
```
```

rpg =

1

ifail =

0

```

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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