# naginterfaces.library.linsys.real_​sparse_​fac_​solve¶

naginterfaces.library.linsys.real_sparse_fac_solve(a, comm, rhs, mtype)[source]

real_sparse_fac_solve calculates the approximate solution of a set of real sparse linear equations with a single right-hand side, or , where has been factorized by matop.real_gen_sparse_lu or matop.real_gen_sparse_lu_reuse.

For full information please refer to the NAG Library document for f04ax

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/f04/f04axf.html

Parameters
afloat, array-like, shape

The nonzero elements in the factorization of the matrix , as returned by matop.real_gen_sparse_lu or matop.real_gen_sparse_lu_reuse.

commdict, communication object

Communication structure.

This argument must have been initialized by a prior call to matop.real_gen_sparse_lu.

rhsfloat, array-like, shape

The right-hand side vector .

mtypeint

specifies the task to be performed.

Solve .

Solve .

Returns
rhsfloat, ndarray, shape

is overwritten by the solution vector .

residfloat

The value of the maximum residual, , over all the unsatisfied equations, in case matop.real_gen_sparse_lu or matop.real_gen_sparse_lu_reuse has been used to factorize a singular or rectangular matrix.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

To solve a system of real linear equations or , where is a general sparse matrix, must first be factorized by matop.real_gen_sparse_lu or matop.real_gen_sparse_lu_reuse. real_sparse_fac_solve then computes 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 function sparse.direct_real_gen_solve and factorization function sparse.direct_real_gen_lu.

References

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