LA_LUMPROVE

The LA_LUMPROVE function uses LU decomposition to improve the solution to a system of linear equations, AX = B, and provides optional error bounds and backward error estimates.

The LA_LUMPROVE function may also be used to improve the solutions for multiple systems of linear equations, with each column of B representing a different set of equations. In this case, the result is a k-by-n array where each of the k columns represents the improved solution vector for that set of equations.

LA_LUMPROVE is based on the following LAPACK routines:

Output Type

LAPACK Routine

Float

sgerfs

Double

dgetrfs

Complex

cgetrfs

Double complex

zgetrfs

Examples

The solution to a given system of equations can be derived and improved by using the following program:

; Define the coefficient array:

a= [[4, 16000, 17000], $

   [2, 5, 8], $

   [3, 6, 10]]

; Compute the LU decomposition:

aludc = a

; make a copy

LA_LUDC, aludc, index

 

; Define the right-hand side vector B:

b = [100.1, 0.1, 0.01]

; Find the solution to Ax=b:

x = LA_LUSOL(aludc, index, b)

PRINT, 'LA_LUSOL Solution:', x

 

; Improve the solution:

xnew = LA_LUMPROVE(a, aludc, index, b, x)

PRINT, 'LA_LUMPROVE Solution:', xnew

IDL prints:

LA_LUSOL Solution:

-0.397355 -0.334742 0.321033

LA_LUMPROVE Solution:

-0.397432 -0.334865 0.321148

The exact solution to 6 decimal places is [-0.397432, -0.334865, 0.321149].

Syntax

Result = LA_LUMPROVE( Array, Aludc, Index, B, X [, BACKWARD_ERROR=variable] [, /DOUBLE] [, FORWARD_ERROR=variable])

Return Value

The result is an n-element vector or k-by-n array.

Arguments

Array

The original n-by-n array of the linear system.

Aludc

The n-by-n LU decomposition of Array, created by the LA_LUDC procedure.

Index

An n-element input vector, created by the LA_LUDC procedure, containing the row permutations which occurred as a result of partial pivoting.

B

An n-element input vector containing the right-hand side of the linear system, or a k-by-n array, where each of the k columns represents a different linear system.

X

An n-element input vector, or a k-by-n array, containing the approximate solutions to the linear system, created by the LA_LUSOL function.

Keywords

BACKWARD_ERROR

Set this keyword to a named variable that will contain the relative backward error estimate for each linear system. If B is a vector containing a single linear system, then BACKWARD_ERROR will be a scalar. If B is an array containing k linear systems, then BACKWARD_ERROR will be a k-element vector. The backward error is the smallest relative change in any element of A or B that makes X an exact solution.

DOUBLE

Set this keyword to use double-precision for computations and to return a double-precision (real or complex) result. Set DOUBLE = 0 to use single-precision for computations and to return a single-precision (real or complex) result. The default is /DOUBLE if Array is double precision, otherwise the default is DOUBLE = 0.

FORWARD_ERROR

Set this keyword to a named variable that will contain the estimated forward error bound for each linear system. If B is a vector containing a single linear system, then FORWARD_ERROR will be a scalar. If B is an array containing k linear systems, then FORWARD_ERROR will be a k-element vector. For each linear system, if Xtrue is the true solution corresponding to X, then the forward error is an estimated upper bound for the magnitude of the largest element in (X - Xtrue) divided by the magnitude of the largest element in X.

Version History

5.6

Introduced

Resources and References

For details see Anderson et al., LAPACK Users' Guide, 3rd ed., SIAM, 1999.

See Also

LA_LUDC, LA_LUSOL, LUMPROVE