MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
chol.h File Reference

Data Structures

struct  spchol

Macros

#define chol_free(A)

Functions

spchol * chol_factorize (const dsp *A_in)
dsp * chol_factorize2 (lmat **Cp, const dsp *A_in)
void chol_solve (dmat **x, spchol *A, dmat *y)
dsp * chol_spsolve (spchol *A, const dsp *y)
void chol_free_do (spchol *A)
void chol_save (spchol *A, const char *format,...)
spchol * chol_read (const char *format,...)
void chol_convert (spchol *A, int keep)

Detailed Description

Wraps the CHOLESKY Library to provide a simple interface.


Data Structure Documentation

◆ spchol

struct spchol
Collaboration diagram for spchol:
Data Fields
struct cholmod_factor_struct * L
struct cholmod_common_struct * c
dsp * Cl
dsp * Cu
spint * Cp

Macro Definition Documentation

◆ chol_free

#define chol_free ( A)
Value:
({chol_free_do(A);A=NULL;})

Function Documentation

◆ chol_factorize()

spchol * chol_factorize ( const dsp * A_in)

Factorize a sparse array into LL' with reordering. Errors out if the factorization fails.

Parameters
[in]A_inSymmetric positive definite sparse matrix. Only the upper triangular part is used.
Returns
Newly allocated cholesky factor, or NULL if A_in is NULL. Free with chol_free().

◆ chol_factorize2()

dsp * chol_factorize2 ( lmat ** Cp,
const dsp * A_in )

Alternative interface to chol_factorize(). Returns the lower triangular cholesky factor as dsp and, if Cp is not NULL, the permutation vector in *Cp.

Parameters
[out]CpIf not NULL, *Cp is set to a newly allocated permutation vector. The caller frees it.
[in]A_inSymmetric positive definite sparse matrix.
Returns
Newly allocated lower triangular cholesky factor. The caller frees it.

◆ chol_solve()

void chol_solve ( dmat ** x,
spchol * A,
dmat * y )

Solve A*x=y where the cholesky factor of A is stored in A.

Parameters
[in,out]xSolution. Allocated if NULL; otherwise overwritten.
[in]ACholesky factor.
[in]yRight hand side.

◆ chol_spsolve()

dsp * chol_spsolve ( spchol * A,
const dsp * y )

Solve A*x=y where Y is sparse. Not good idea to use dsp ** as chol_solve because the result may have different nzmax.

Parameters
[in]ACholesky factor with the native cholmod factor L.
[in]ySparse right hand side.
Returns
Newly allocated sparse solution. The caller frees it.

◆ chol_free_do()

void chol_free_do ( spchol * A)

Free cholesky factor.

Parameters
[in,out]ACholesky factor to free. May be NULL.

◆ chol_save()

void chol_save ( spchol * A,
const char * format,
... )

Save cholesky factor and permutation vector to file.

Parameters
[in]ACholesky factor.
[in]formatprintf style format of the file name, followed by its arguments.

◆ chol_read()

spchol * chol_read ( const char * format,
... )

Read cholesky factor form file. In the matlab convention, the upper triangle is saved.

Parameters
[in]formatprintf style format of the file name, followed by its arguments.
Returns
Newly allocated cholesky factor. Free with chol_free().

◆ chol_convert()

void chol_convert ( spchol * A,
int keep )

Convert the internal data type cholesky factor into the lower left diagonal and permutation vector. The internal data A->L is freed if keep is 0.

This routine works only if the factor is using simplicity factor. not supernodal. so, in chol_factorize, we have set c.final_super=0, so that the final result is always in simplicity factor.

Parameters
[in,out]ACholesky factor. Cl and Cp are filled. Does nothing if A->L is not set or Cl/Cp already exist.
[in]keepWhether to keep the internal factor A->L (and A->c). If kept, Cp references A->L->Perm.