A high-performance general-purpose compute library

Perform Cholesky decomposition. More...

Functions

AFAPI int cholesky (array &out, const array &in, const bool is_upper=true)
 C++ Interface to perform Cholesky decomposition. More...
 
AFAPI int choleskyInPlace (array &in, const bool is_upper=true)
 C++ Interface to perform in-place Cholesky decomposition. More...
 
AFAPI af_err af_cholesky (af_array *out, int *info, const af_array in, const bool is_upper)
 C Interface to perform Cholesky decomposition. More...
 
AFAPI af_err af_cholesky_inplace (int *info, af_array in, const bool is_upper)
 C Interface to perform in-place Cholesky decomposition. More...
 

Detailed Description

Perform Cholesky decomposition.

This function decomposes a positive definite matrix \(A\) into two triangular matrices such that, \(A = L * U\) and \(L = U^T\).

Only one of \(L\) and \(U\) is stored to conserve space when solving linear equations.

This operation can be performed in ArrayFire using the following code snippet.

array out;
cholesky(out, in, is_upper);

When memory is a concern, users can perform Cholesky decomposition in place as shown below.

array in2 = in.copy();
choleskyInPlace(in2, is_upper);

Function Documentation

◆ af_cholesky()

AFAPI af_err af_cholesky ( af_array out,
int *  info,
const af_array  in,
const bool  is_upper 
)

C Interface to perform Cholesky decomposition.

Multiplying out with its conjugate transpose reproduces the input in.

The input must be positive definite.

Parameters
[out]outtriangular matrix;
[out]info0 if cholesky decomposition passes; if not, it returns the rank at which the decomposition fails
[in]ininput matrix
[in]is_upperboolean determining if out is upper or lower triangular
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_cholesky_inplace()

AFAPI af_err af_cholesky_inplace ( int *  info,
af_array  in,
const bool  is_upper 
)

C Interface to perform in-place Cholesky decomposition.

The input must be positive definite.

Parameters
[out]info0 if cholesky decomposition passes; if not, it returns the rank at which the decomposition fails
[in,out]ininput matrix on entry; triangular matrix on exit
[in]is_upperboolean determining if in is upper or lower triangular
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ cholesky()

AFAPI int cholesky ( array out,
const array in,
const bool  is_upper = true 
)

C++ Interface to perform Cholesky decomposition.

Multiplying out with its conjugate transpose reproduces the input in.

The input must be positive definite.

This function is not supported in GFOR.

Parameters
[out]outtriangular matrix;
[in]ininput matrix
[in]is_upperboolean determining if out is upper or lower triangular
Returns
0 if cholesky decomposition passes; if not, it returns the rank at which the decomposition fails

◆ choleskyInPlace()

AFAPI int choleskyInPlace ( array in,
const bool  is_upper = true 
)

C++ Interface to perform in-place Cholesky decomposition.

The input must be positive definite.

This function is not supported in GFOR.

Parameters
[in,out]ininput matrix on entry; triangular matrix on exit
[in]is_upperboolean determining if in is upper or lower triangular
Returns
0 if cholesky decomposition passes; if not, it returns the rank at which the decomposition fails