LA_CHOLMPROVE
The LA_CHOLMPROVE function uses Cholesky factorization to improve the solution to a system of linear equations, AX = B (where A is symmetric or Hermitian), and provides optional error bounds and backward error estimates.
The LA_CHOLMPROVE 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_CHOLMPROVE is based on the following LAPACK routines:
Output Type |
LAPACK Routine |
Float |
sporfs |
Double |
dporfs |
Complex |
cporfs |
Double complex |
zporfs |
Examples
The following example program computes an improved solution to a set of 10 equations:
; Create a symmetric positive-definite array.
n = 10
seed = 12321
a = RANDOMU(seed, n, n, /DOUBLE)
a = a ## TRANSPOSE(a)
; Create the right-hand side vector b:
b = RANDOMU(seed, n, /DOUBLE)
; Compute the Cholesky decomposition.
achol = a ; make a copy
LA_CHOLDC, achol
; Compute the first approximation to the solution:
x = LA_CHOLSOL(achol, b)
; Improve the solution and print the error estimate:
xmprove = LA_CHOLMPROVE(a, achol, b, x, $
FORWARD_ERROR = fError)
PRINT, 'LA_CHOLMPROVE error:', $
MAX(ABS(a ## xmprove - b))
PRINT, 'LA_CHOLMPROVE Error Estimate:', fError
When this program is compiled and run, IDL prints:
LA_CHOLMPROVE error: 3.2529535e-014
LA_CHOLMPROVE Error Estimate: 2.0425691e-012
Syntax
Result = LA_CHOLMPROVE( Array, Achol, B, X [, BACKWARD_ERROR=variable] [, /DOUBLE] [, FORWARD_ERROR=variable] [, /UPPER] )
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 AX = B.
Achol
The n-by-n Cholesky factorization of Array, created by the LA_CHOLDC procedure.
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_CHOLSOL 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.
UPPER
Set this keyword if A contains the upper triangular array, rather than the lower triangular array.
Note: If the UPPER keyword is set in LA_CHOLDC and LA_CHOLSOL then the UPPER keyword must also be set in LA_CHOLMPROVE.
Version History
5.6 |
Introduced |
Resources and References
For more details, see Anderson et al., LAPACK Users' Guide, 3rd ed., SIAM, 1999.