Routines (alphabetical) > Routines: L > LA_CHOLDC

# LA_CHOLDC

The LA_CHOLDC procedure computes the Cholesky factorization of an n-by-n symmetric (or Hermitian) positive-definite array as:

If A is real: A = UT U or A = L LT

If A is complex: A = UH U or A = L LH

where U and L are upper and lower triangular arrays. The T represents the transpose while H represents the Hermitian, or transpose complex conjugate.

LA_CHOLDC is based on the following LAPACK routines:

Output Type | LAPACK Routine
Float | spotrf
Double | dpotrf
Complex | cpotrf
Double complex | zpotrf

## Examples

The following example program computes the Cholesky decomposition of a given symmetric positive-definite array:

; Create a symmetric positive-definite array.

n = 10

seed = 12321

array = RANDOMU(seed, n, n)

array = array ## TRANSPOSE(Array)

; Compute the Cholesky decomposition.

lower = array ; make a copy

LA_CHOLDC, lower

; Zero out the upper triangular portion.

for i = 0,n - 2 Do lower[i+1:*,i] = 0

; Reconstruct the array and check the difference

arecon = lower ## TRANSPOSE(lower)

PRINT, 'LA_CHOLDC Error:', MAX(ABS(arecon - array))

When this program is compiled and run, IDL prints:

LA_CHOLDC Error: 2.38419e-007

## Syntax

LA_CHOLDC, Array [, /DOUBLE] [, STATUS=variable] [, /UPPER]

## Arguments

### Array

A named variable containing the real or complex array to be factorized. Only the lower triangular portion of Array is used (or upper if the UPPER keyword is set). This procedure returns Array as a lower triangular array from the Cholesky decomposition (upper triangular if the UPPER keyword is set).

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

### STATUS

Set this keyword to a named variable that will contain the status of the computation. Possible values are:

- STATUS = 0: The computation was successful.
- STATUS > 0: The array is not positive definite and the factorization could not be completed. The STATUS value specifies the order of the leading minor which is not positive definite.

Note: If STATUS is not specified, any error messages will output to the screen.

### UPPER

If this keyword is set, then only the upper triangular portion of Array is used, and the upper triangular array is returned. The default is to use the lower triangular portion and to return the lower triangular array.

## Version History

5.6 | Introduced

## Resources and References

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

## See Also

CHOLDC, LA_CHOLMPROVE, LA_CHOLSOL