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:
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
-0.397355 -0.334742 0.321033
-0.397432 -0.334865 0.321148
The exact solution to 6 decimal places is [-0.397432, -0.334865, 0.321149].
The result is an n-element vector or k-by-n array.
The original n-by-n array of the linear system.
The n-by-n LU decomposition of Array, created by the LA_LUDC procedure.
An n-element input vector, created by the LA_LUDC procedure, containing the row permutations which occurred as a result of partial pivoting.
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.
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.
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.
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.
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.
Resources and References
For details see Anderson et al., LAPACK Users' Guide, 3rd ed., SIAM, 1999.
This page has no user notes yet. Be the first one!