The LA_LUSOL function is used in conjunction with the LA_LUDC procedure to solve a set of n linear equations in n unknowns, AX = B. The parameter A is not the original array, but its LU decomposition, created by the routine LA_LUDC.
The LA_LUSOL function may also be used to solve 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 solution vector for that set of equations.
LA_LUSOL is based on the following LAPACK routines:
For details see Anderson et al., LAPACK Users' Guide, 3rd ed., SIAM, 1999.
Result = LA_LUSOL( A, Index, B [, /DOUBLE] )
The result is an n-element vector or k-by-n array.
The n-by-n LU decomposition of an array, created by the LA_LUDC procedure.
| Note |
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.
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 A is double precision, otherwise the default is DOUBLE = 0.
Given the system of equations:
4u + 16000v + 17000w = 100.1 2u + 5v + 8w = 0.1 3u + 6v + 10w = 0.01
find the solution can be derived by using the following program:
PRO ExLA_LUSOL ; 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] ; Compute and print the solution to Ax=b: x = LA_LUSOL(aludc, index, b) PRINT, 'LA_LUSOL Solution:', x END
When this program is compiled and run, IDL prints:
LA_LUSOL solution: -0.397355 -0.334742 0.321033
The exact solution to 6 decimal places is [-0.397432, -0.334865, 0.321149].
| Note |
Introduced 5.6
LA_LINEAR_EQUATION, LA_LUDC, LA_LUMPROVE, LUSOL