# Cholesky

Advanced Analysis Library Only

AnalysisLibErrType Cholesky (void *inputMatrix, int matrixSize, void *MatrixR);

## Purpose

Calculates the Cholesky factorization of a real, symmetric positive definite input matrix. If the input matrix is not positive definite, Cholesky returns an error.

The following formula defines the Cholesky factorization of an n-by-n symmetric positive definite matrix A:

A = RTR

where | R is an upper triangular matrix of dimensions n-by-n
| RT is the transpose of R

Cholesky factorization is similar to LU factorization for symmetric positive definite matrices. If the matrix in your application is positive definite, use Cholesky factorization rather than LU factorization for the following reasons:

- The algorithm is well defined.
- Numerical stability does not require pivoting.
- Cholesky factorization requires about half the programming time and less memory than LU factorization.

## Parameters

Input
Name | Type | Description
inputMatrix | numeric array | Input square, positive definite matrix. This matrix must be an array of doubles.
matrixSize | integer | Number of elements in one dimension of the matrix.
Output
Name | Type | Description
MatrixR | numeric array | Result matrix of the Cholesky decomposition as an array of doubles.

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.