# naginterfaces.library.lapacklin.dgtrfs¶

naginterfaces.library.lapacklin.dgtrfs(trans, n, nrhs, dl, d, du, dlf, df, duf, du2, ipiv, b, x)[source]

dgtrfs computes error bounds and refines the solution to a real system of linear equations or , where is an tridiagonal matrix and and are matrices, using the factorization returned by dgttrf() and an initial solution returned by dgttrs(). Iterative refinement is used to reduce the backward error as much as possible.

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

https://www.nag.com/numeric/nl/nagdoc_27.3/flhtml/f07/f07chf.html

Parameters
transstr, length 1

Specifies the equations to be solved as follows:

Solve for .

or

Solve for .

nint

, the order of the matrix .

nrhsint

, the number of right-hand sides, i.e., the number of columns of the matrix .

dlfloat, array-like, shape

Must contain the subdiagonal elements of the matrix .

dfloat, array-like, shape

Must contain the diagonal elements of the matrix .

dufloat, array-like, shape

Must contain the superdiagonal elements of the matrix .

dlffloat, array-like, shape

Must contain the multipliers that define the matrix of the factorization of .

dffloat, array-like, shape

Must contain the diagonal elements of the upper triangular matrix from the factorization of .

duffloat, array-like, shape

Must contain the elements of the first superdiagonal of .

du2float, array-like, shape

Must contain the elements of the second superdiagonal of .

ipivint, array-like, shape

Must contain the pivot indices that define the permutation matrix . At the th step, row of the matrix was interchanged with row , and must always be either or , indicating that a row interchange was not performed.

bfloat, array-like, shape

The matrix of right-hand sides .

xfloat, array-like, shape

The initial solution matrix .

Returns
xfloat, ndarray, shape

The refined solution matrix .

ferrfloat, ndarray, shape

Estimate of the forward error bound for each computed solution vector, such that , where is the th column of the computed solution returned in the array and is the corresponding column of the exact solution . The estimate is almost always a slight overestimate of the true error.

berrfloat, ndarray, shape

Estimate of the component-wise relative backward error of each computed solution vector (i.e., the smallest relative change in any element of or that makes an exact solution).

Raises
NagValueError
(errno )

On entry, error in parameter .

Constraint: , or .

(errno )

On entry, error in parameter .

Constraint: .

(errno )

On entry, error in parameter .

Constraint: .

Notes

dgtrfs should normally be preceded by calls to dgttrf() and dgttrs(). dgttrf() uses Gaussian elimination with partial pivoting and row interchanges to factorize the matrix as

where is a permutation matrix, is unit lower triangular with at most one nonzero subdiagonal element in each column, and is an upper triangular band matrix, with two superdiagonals. dgttrs() then utilizes the factorization to compute a solution, , to the required equations. Letting denote a column of , dgtrfs computes a component-wise backward error, , the smallest relative perturbation in each element of and such that is the exact solution of a perturbed system

The function also estimates a bound for the component-wise forward error in the computed solution defined by , where is the corresponding column of the exact solution, .

References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug