Perform Cholesky decomposition. More...

Functions

AFAPI int cholesky (array &out, const array &in, const bool is_upper=true)
 C++ Interface for cholesky decomposition. More...
 
AFAPI int choleskyInPlace (array &in, const bool is_upper=true)
 C++ Interface for 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 for cholesky decomposition. More...
 
AFAPI af_err af_cholesky_inplace (int *info, af_array in, const bool is_upper)
 C Interface for in place cholesky decomposition. More...
 

Detailed Description

Perform Cholesky decomposition.

This function decomposes a positive definite matrix A into two triangular matrices such that

 \f$A = L * U\f$

 \f$L = U^T\f$

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 for cholesky decomposition.

Parameters
[out]outcontains the triangular matrix. Multiply out with it conjugate transpose reproduces the input in.
[out]infois 0 if cholesky decomposition passes, if not it returns the rank at which the decomposition failed.
[in]inis the input matrix
[in]is_uppera boolean determining if out is upper or lower triangular
Note
The input matrix has to be a positive definite matrix, if it is not zero, the cholesky decomposition functions return a non zero output.

◆ af_cholesky_inplace()

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

C Interface for in place cholesky decomposition.

Parameters
[out]infois 0 if cholesky decomposition passes, if not it returns the rank at which the decomposition failed.
[in,out]inis the input matrix on entry. It contains the triangular matrix on exit.
[in]is_uppera boolean determining if in is upper or lower triangular
Note
The input matrix has to be a positive definite matrix, if it is not zero, the cholesky decomposition functions return a non zero output.

◆ cholesky()

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

C++ Interface for cholesky decomposition.

Parameters
[out]outcontains the triangular matrix. Multiply out with its conjugate transpose reproduces the input in.
[in]inis the input matrix
[in]is_uppera boolean determining if out is upper or lower triangular
Returns
0 if cholesky decomposition passes, if not it returns the rank at which the decomposition failed.
Note
The input matrix has to be a positive definite matrix, if it is not zero, the cholesky decomposition functions return a non-zero output.
This function is not supported in GFOR
Examples
lin_algebra/cholesky.cpp.

◆ choleskyInPlace()

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

C++ Interface for in place cholesky decomposition.

Parameters
[in,out]inis the input matrix on entry. It contains the triangular matrix on exit.
[in]is_uppera boolean determining if in is upper or lower triangular
Returns
0 if cholesky decomposition passes, if not it returns the rank at which the decomposition failed.
Note
The input matrix has to be a positive definite matrix, if it is not zero, the cholesky decomposition functions return a non-zero output.
This function is not supported in GFOR
Examples
lin_algebra/cholesky.cpp.
af::cholesky
AFAPI int cholesky(array &out, const array &in, const bool is_upper=true)
C++ Interface for cholesky decomposition.
afcl::array
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
af::choleskyInPlace
AFAPI int choleskyInPlace(array &in, const bool is_upper=true)
C++ Interface for in place cholesky decomposition.
af::array::copy
array copy() const
Perform deep copy of the array.