NAG Library Routine Document
calculates the approximate solution of a set of real sparse linear equations with a single right-hand side,
has been factorized by f01brf
|Integer, Intent (In)||:: ||n, licn, icn(licn), mtype, idisp(2)|
|Integer, Intent (Inout)||:: ||ikeep(5*n)|
|Real (Kind=nag_wp), Intent (In)||:: ||a(licn)|
|Real (Kind=nag_wp), Intent (Inout)||:: ||rhs(n)|
|Real (Kind=nag_wp), Intent (Out)||:: ||w(n), resid|C Header Interface
f04axf_ (const Integer *n, const double a, const Integer *licn, const Integer icn, Integer ikeep, double rhs, double w, const Integer *mtype, const Integer idisp, double *resid)|
To solve a system of real linear equations
is a general sparse matrix,
must first be factorized by f01brf
by block forward or backward substitution using simple forward and backward substitution within each diagonal block.
The method is fully described in Duff (1977)
A more recent method is available through solver routine f11mff
and factorization routine f11mef
Duff I S (1977) MA28 – a set of Fortran subroutines for sparse unsymmetric linear equations AERE Report R8730 HMSO
- 1: – IntegerInput
On entry: , the order of the matrix .
- 2: – Real (Kind=nag_wp) arrayInput
: the nonzero elements in the factorization of the matrix
, as returned by f01brf
- 3: – IntegerInput
: the dimension of the arrays a
as declared in the (sub)program from which f04axf
- 4: – Integer arrayCommunication Array
: the column indices of the nonzero elements of the factorization, as returned by f01brf
- 5: – Integer arrayInput
provides, on entry, indexing information about the factorization, as returned by f01brf
. Used as internal workspace prior to being restored and hence is unchanged.
- 6: – Real (Kind=nag_wp) arrayInput/Output
On entry: the right-hand side vector .
is overwritten by the solution vector
- 7: – Real (Kind=nag_wp) arrayWorkspace
- 8: – IntegerInput
specifies the task to be performed.
- Solve .
- Solve .
- 9: – Integer arrayCommunication Array
: the values returned in idisp
- 10: – Real (Kind=nag_wp)Output
: the value of the maximum residual,
, over all the unsatisfied equations, in case f01brf
has been used to factorize a singular or rectangular matrix.
Error Indicators and Warnings
If an error is detected in an input argument f04axf
will act as if a soft noisy exit has been requested (see Section 3.4.4
in How to Use the NAG Library and its Documentation).
The accuracy of the computed solution depends on the conditioning of the original matrix. Since f04axf
is always used with either f01brf
, you are recommended to set
on entry to these routines and to examine the value of
on exit (see f01brf
). For a detailed error analysis see page 17 of Duff (1977)
If storage for the original matrix is available then the error can be estimated by calculating the residual
and calling f04axf
again to find a correction
Parallelism and Performance
f04axf is not threaded in any implementation.
If the factorized form contains nonzeros () then the time taken is very approximately times longer than the inner loop of full matrix code. Some advantage is taken of zeros in the right-hand side when solving ().
This example solves the set of linear equations
The nonzero elements of
and indexing information are read in by the program, as described in the document for f01brf
Program Text (f04axfe.f90)
Program Data (f04axfe.d)
Program Results (f04axfe.r)