F01BSF (PDF version)
F01 Chapter Contents
F01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F01BSF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

F01BSF factorizes a real sparse matrix using the pivotal sequence previously obtained by F01BRF when a matrix of the same sparsity pattern was factorized.

2  Specification

SUBROUTINE F01BSF ( N, NZ, A, LICN, IVECT, JVECT, ICN, IKEEP, IW, W, GROW, ETA, RPMIN, ABORT, IDISP, IFAIL)
INTEGER  N, NZ, LICN, IVECT(NZ), JVECT(NZ), ICN(LICN), IKEEP(5*N), IW(5*N), IDISP(2), IFAIL
REAL (KIND=nag_wp)  A(LICN), W(N), ETA, RPMIN
LOGICAL  GROW, ABORT

3  Description

F01BSF accepts as input a real sparse matrix of the same sparsity pattern as a matrix previously factorized by a call of F01BRF. It first applies to the matrix the same permutations as were used by F01BRF, both for permutation to block triangular form and for pivoting, and then performs Gaussian elimination to obtain the LU factorization of the diagonal blocks.
Extensive data checks are made; duplicated nonzeros can be accumulated.
The factorization is intended to be used by F04AXF to solve sparse systems of linear equations Ax=b or ATx=b.
F01BSF is much faster than F01BRF and in some applications it is expected that there will be many calls of F01BSF for each call of F01BRF.
The method is fully described in Duff (1977).
A more recent algorithm for the same calculation is provided by F11MEF.

4  References

Duff I S (1977) MA28 – a set of Fortran subroutines for sparse unsymmetric linear equations AERE Report R8730 HMSO

5  Parameters

1:     N – INTEGERInput
On entry: n, the order of the matrix A.
Constraint: N>0.
2:     NZ – INTEGERInput
On entry: the number of nonzero elements in the matrix A.
Constraint: NZ>0.
3:     ALICN – REAL (KIND=nag_wp) arrayInput/Output
On entry: Ai, for i=1,2,,NZ, must contain the nonzero elements of the sparse matrix A. They can be in any order since F01BSF will reorder them.
On exit: the nonzero elements in the LU factorization. The array must not be changed by you between a call of F01BSF and a call of F04AXF.
4:     LICN – INTEGERInput
On entry: the dimension of the arrays A and ICN as declared in the (sub)program from which F01BSF is called. It should have the same value as it had for F01BRF.
Constraint: LICNNZ.
5:     IVECTNZ – INTEGER arrayInput
6:     JVECTNZ – INTEGER arrayInput
On entry: IVECTi and JVECTi, for i=1,2,,NZ, must contain the row index and the column index respectively of the nonzero element stored in Ai.
7:     ICNLICN – INTEGER arrayInput
ICN contains, on entry, the same information as output by F01BRF. It must not be changed by you between a call of F01BSF and a call of F04AXF.
ICN is used as internal workspace prior to being restored on exit and hence is unchanged.
8:     IKEEP5×N – INTEGER arrayCommunication Array
On entry: the same indexing information about the factorization as output in IKEEP by F01BRF.
You must not change IKEEP between a call of F01BSF and subsequent calls to F04AXF.
9:     IW5×N – INTEGER arrayWorkspace
10:   WN – REAL (KIND=nag_wp) arrayOutput
On exit: if GROW=.TRUE., W1 contains an estimate (an upper bound) of the increase in size of elements encountered during the factorization (see GROW); the rest of the array is used as workspace.
If GROW=.FALSE., the array is not used.
11:   GROW – LOGICALInput
On entry: if GROW=.TRUE., then on exit W1 contains an estimate (an upper bound) of the increase in size of elements encountered during the factorization. If the matrix is well-scaled (see Section 9), then a high value for W1 indicates that the LU factorization may be inaccurate and you should be wary of the results and perhaps increase the parameter PIVOT for subsequent runs (see Section 7).
12:   ETA – REAL (KIND=nag_wp)Input
On entry: the relative pivot threshold below which an error diagnostic is provoked and IFAIL is set to IFAIL=7. If ETA is greater than 1.0, then no check on pivot size is made.
Suggested value: ETA=10-4.
13:   RPMIN – REAL (KIND=nag_wp)Output
On exit: if ETA is less than 1.0, then RPMIN gives the smallest ratio of the pivot to the largest element in the row of the corresponding upper triangular factor thus monitoring the stability of the factorization. If RPMIN is very small it may be advisable to perform a new factorization using F01BRF.
14:   ABORT – LOGICALInput
On entry: if ABORT=.TRUE., F01BSF exits immediately (with IFAIL=8) if it finds duplicate elements in the input matrix.
If ABORT=.FALSE., F01BSF proceeds using a value equal to the sum of the duplicate elements.
In either case details of each duplicate element are output on the current advisory message unit (see X04ABF), unless suppressed by the value of IFAIL on entry.
Suggested value: ABORT=.TRUE..
15:   IDISP2 – INTEGER arrayCommunication Array
On entry: IDISP1 and IDISP2 must be as output in IDISP by the previous call of F01BRF.
16:   IFAIL – INTEGERInput/Output
For this routine, the normal use of IFAIL is extended to control the printing of error and warning messages as well as specifying hard or soft failure (see Section 3.3 in the Essential Introduction).
On entry: IFAIL must be set to a value with the decimal expansion cba, where each of the decimal digits c, b and a must have a value of 0 or 1.
a=0 specifies hard failure, otherwise soft failure;
b=0 suppresses error messages, otherwise error messages will be printed (see Section 6);
c=0 suppresses warning messages, otherwise warning messages will be printed (see Section 6).
The recommended value for inexperienced users is 110 (i.e., hard failure with all messages printed).
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,N0.
IFAIL=2
On entry,NZ0.
IFAIL=3
On entry,LICN<NZ.
IFAIL=4
On entry, an element of the input matrix has a row or column index (i.e., an element of IVECT or JVECT) outside the range 1 to N.
IFAIL=5
The input matrix is incompatible with the matrix factorized by the previous call of F01BRF (see Section 9).
IFAIL=6
The input matrix is numerically singular.
IFAIL=7
A very small pivot has been detected (see Section 5, ETA). The factorization has been completed but is potentially unstable.
IFAIL=8
Duplicate elements have been found in the input matrix and the factorization has been abandoned (ABORT=.TRUE. on entry).
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

The factorization obtained is exact for a perturbed matrix whose i,jth element differs from aij by less than 3ερmij where ε is the machine precision, ρ is the growth value returned in W1 if GROW=.TRUE., and mij the number of Gaussian elimination operations applied to element i,j.
If ρ=W1 is very large or RPMIN is very small, then a fresh call of F01BRF is recommended.

8  Parallelism and Performance

Not applicable.

9  Further Comments

If you have a sequence of problems with the same sparsity pattern then F01BSF is recommended after F01BRF has been called for one such problem. It is typically 4 to 7 times faster but is potentially unstable since the previous pivotal sequence is used. Further details on timing are given in the document for F01BRF.
If growth estimation is performed (GROW=.TRUE.), then the time increases by between 5% and 10%. Pivot size monitoring (ETA1.0) involves a similar overhead.
We normally expect this routine to be entered with a matrix having the same pattern of nonzeros as was earlier presented to F01BRF. However there is no record of this pattern, but rather a record of the pattern including all fill-ins. Therefore we permit additional nonzeros in positions corresponding to fill-ins.
If singular matrices are being treated then it is also required that the present matrix be sufficiently like the previous one for the same permutations to be suitable for factorization with the same set of zero pivots.

10  Example

This example factorizes the real sparse matrices
5 0 0 0 0 0 0 2 -1 2 0 0 0 0 3 0 0 0 -2 0 0 1 1 0 -1 0 0 -1 2 -3 -1 -1 0 0 0 6  
and
10 0 0 0 0 0 0 12 -3 -1 0 0 0 0 15 0 0 0 -2 0 0 10 -1 0 -1 0 0 -5 1 -1 -1 -2 0 0 0 6 .  
This example program simply prints the values of W1 and RPMIN returned by F01BSF. Normally the calls of F01BRF and F01BSF would be followed by calls of F04AXF.

10.1  Program Text

Program Text (f01bsfe.f90)

10.2  Program Data

Program Data (f01bsfe.d)

10.3  Program Results

Program Results (f01bsfe.r)


F01BSF (PDF version)
F01 Chapter Contents
F01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015