Routines (alphabetical) > Routines: L > LA_CHOLSOL

# LA_CHOLSOL

The LA_CHOLSOL function is used in conjunction with the LA_CHOLDC to solve a set of n linear equations in n unknowns, AX = B, where A must be a symmetric (or Hermitian) positive-definite array. The parameter A is input not as the original array, but as its Cholesky decomposition, created by the routine LA_CHOLDC.

The LA_CHOLSOL 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_CHOLSOL is based on the following LAPACK routines:

Output Type | LAPACK Routine
Float | spotrs
Double | dpotrs
Complex | cpotrs
Double complex | zpotrs

## Examples

Given the following system of equations:

6u + 15v + 55w = 9.5

15u + 55v + 225w = 50

55u + 225v + 979w = 237

The solution can be derived by using the following program:

; Define the coefficient array:

a = [[6.0, 15.0, 55.0], $

[15.0, 55.0, 225.0], $

[55.0, 225.0, 979.0]]

; Define the right-hand side vector b:

b = [9.5, 50.0, 237.0]

; Compute the Cholesky decomposition of a:

achol = a ; make a copy

LA_CHOLDC, achol

; Compute and print the solution:

x = LA_CHOLSOL(achol, b)

PRINT, 'LA_CHOLSOL solution:', x

When this program is compiled and run, IDL prints:

LA_CHOLSOL Solution:

-0.499999 -1.00000 0.500000

The exact solution vector is [-0.5, -1.0, 0.5].

## Syntax

Result = LA_CHOLSOL( A, B [, /DOUBLE] [, /UPPER] )

## Return Value

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

## Arguments

### A

The n-by-n Cholesky factorization of an 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.

## Keywords

### 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 A is double precision, otherwise the default is DOUBLE = 0.

### 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 the LA_CHOLDC then the UPPER keyword must also be set in LA_CHOLSOL.

## Version History

5.6 | Introduced

## Resources and References

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

## See Also

CHOLSOL, LA_CHOLDC, LA_CHOLMPROVE