# naginterfaces.library.sparse.direct_​real_​gen_​refine¶

naginterfaces.library.sparse.direct_real_gen_refine(trans, icolzp, irowix, a, iprm, il, lval, iu, uval, nrhs, b, x)[source]

direct_real_gen_refine returns error bounds for the solution of a real sparse system of linear equations with multiple right-hand sides, or . It improves the solution by iterative refinement in standard precision, in order to reduce the backward error as much as possible.

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

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/f11/f11mhf.html

Parameters
transstr, length 1

Specifies whether or is solved.

is solved.

is solved.

icolzpint, array-like, shape

The new column index array of sparse matrix . See the F11 Introduction.

irowixint, array-like, shape

The row index array of sparse matrix . See the F11 Introduction.

afloat, array-like, shape

The array of nonzero values in the sparse matrix .

iprmint, array-like, shape

The column permutation which defines , the row permutation which defines , plus associated data structures as computed by direct_real_gen_lu().

ilint, array-like, shape

Records the sparsity pattern of matrix as computed by direct_real_gen_lu().

lvalfloat, array-like, shape

Records the nonzero values of matrix and some nonzero values of matrix as computed by direct_real_gen_lu().

iuint, array-like, shape

Records the sparsity pattern of matrix as computed by direct_real_gen_lu().

uvalfloat, array-like, shape

Records some nonzero values of matrix as computed by direct_real_gen_lu().

nrhsint

, the number of right-hand sides in .

bfloat, array-like, shape

The right-hand side matrix .

xfloat, array-like, shape

The solution matrix , as returned by direct_real_gen_solve().

Returns
xfloat, ndarray, shape

The improved solution matrix .

ferrfloat, ndarray, shape

contains an estimated error bound for the th solution vector, that is, the th column of , for .

berrfloat, ndarray, shape

contains the component-wise backward error bound for the th solution vector, that is, the th column of , for .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: or .

(errno )

Incorrect row permutations in array .

(errno )

Incorrect column permutations in array .

Notes

direct_real_gen_refine returns the backward errors and estimated bounds on the forward errors for the solution of a real system of linear equations with multiple right-hand sides or . The function handles each right-hand side vector (stored as a column of the matrix ) independently, so we describe the function of direct_real_gen_refine in terms of a single right-hand side and solution .

Given a computed solution , the function computes the component-wise backward error . This is the size of the smallest relative perturbation in each element of and such that if is the exact solution of a perturbed system:

Then the function estimates a bound for the component-wise forward error in the computed solution, defined by:

where is the true solution.

The function uses the factorization computed by direct_real_gen_lu() and the solution computed by direct_real_gen_solve().

References

Golub, G H and Van Loan, C F, 1996, Matrix Computations, (3rd Edition), Johns Hopkins University Press, Baltimore