f01bsf factorizes a real sparse matrix using the pivotal sequence previously obtained by f01brf when a matrix of the same sparsity pattern was factorized.
The routine may be called by the names f01bsf or nagf_matop_real_gen_sparse_lu_reuse.
3Description
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 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 or .
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.
A more recent algorithm for the same calculation is provided by f11mef.
4References
Duff I S (1977) MA28 – a set of Fortran subroutines for sparse unsymmetric linear equations AERE Report R8730 HMSO
5Arguments
1: – IntegerInput
On entry: , the order of the matrix .
Constraint:
.
2: – IntegerInput
On entry: the number of nonzero elements in the matrix .
Constraint:
.
3: – Real (Kind=nag_wp) arrayInput/Output
On entry: , for , must contain the nonzero elements of the sparse matrix . They can be in any order since f01bsf will reorder them.
On exit: the nonzero elements in the factorization. The array must not be changed by you between a call of f01bsf and a call of f04axf.
4: – 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:
.
5: – Integer arrayInput
6: – Integer arrayInput
On entry: and , for , must contain the row index and the column index respectively of the nonzero element stored in .
7: – 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: – 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: – Integer arrayWorkspace
10: – Real (Kind=nag_wp) arrayOutput
On exit: if , 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 , the array is not used.
11: – LogicalInput
On entry: if , then on exit 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 indicates that the factorization may be inaccurate and you should be wary of the results and perhaps increase the argument pivot for subsequent runs (see Section 7).
12: – Real (Kind=nag_wp)Input
On entry: the relative pivot threshold below which an error diagnostic is provoked and ifail is set to . If eta is greater than , then no check on pivot size is made.
Suggested value:
.
13: – Real (Kind=nag_wp)Output
On exit: if eta is less than , 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: – LogicalInput
On entry: if , f01bsf exits immediately (with ) if it finds duplicate elements in the input matrix.
If , 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:
.
15: – Integer arrayCommunication Array
On entry: and must be as output in idisp by the previous call of f01brf.
16: – IntegerInput/Output
This routine uses an ifail input value codification that differs from the normal case to distinguish between errors and warnings (see Section 4 in the Introduction to the NAG Library FL Interface).
On entry: ifail must be set to one of the values below to set behaviour on detection of an error; these values have no effect when no error is detected. The behaviour relate to whether or not program execution is halted and whether or not messages are printed when an error or warning is detected.
For environments where it might be inappropriate to halt program execution when an error is detected, the value , , or is recommended. If the printing of messages is undesirable, then the value is recommended. Otherwise, the recommended value is . When the value , , or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, in f01brf or is out of range: , in f01brf, .
Nonzero element (, ) in zero off-diagonal block.
Nonzero element (, ) was not in L/U pattern.
Numerical singularity in row - decomposition aborted.
Subthreshold pivot in row - decomposition completed.
On entry, duplicate elements found – see advisory messages.
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
The factorization obtained is exact for a perturbed matrix whose th element differs from by less than where is the machine precision, is the growth value returned in if , and the number of Gaussian elimination operations applied to element .
If is very large or rpmin is very small, then a fresh call of f01brf is recommended.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
f01bsf is not threaded in any implementation.
9Further 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 to 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 (), then the time increases by between and . Pivot size monitoring () 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.
10Example
This example factorizes the real sparse matrices
and
This example program simply prints the values of and rpmin returned by f01bsf. Normally the calls of f01brf and f01bsf would be followed by calls of f04axf.