MAOS
Multithreaded Adaptive Optics Simulator
|
Data Structures | |
struct | muv_t |
Typedefs | |
typedef void(* | exfun_t) (dcell **xout, const void *A, const dcell *xin, const real alpha, int xb, int yb) |
Functions | |
void | muv (dcell **xout, const void *A, const dcell *xin, const real alpha) |
void | muv_trans (dcell **xout, const void *A, const dcell *xin, const real alpha) |
void | muv_ib (dcell **xout, const void *A, const dcell *xin, const real alpha) |
void | muv_direct_solve (dcell **xout, const muv_t *A, dcell *xin) |
void | muv_direct_solve_mat (dmat **xout, const muv_t *A, dmat *xin) |
void | muv_direct_prep (muv_t *muv, real svd) |
void | muv_direct_free (muv_t *muv) |
void | muv_direct_diag_solve (dmat **xout, const muv_t *A, dmat *xin, int ib) |
void | muv_bgs_solve (dcell **px, const muv_t *A, const dcell *b) |
real | muv_solve (dcell **px, const muv_t *L, const muv_t *R, dcell *b) |
void * | muv_direct_spsolve (const muv_t *A, const dsp *xin) |
void | muv_direct_diag_prep (muv_t *muv, real svd) |
void | muv_direct_diag_free (muv_t *muv) |
void | muv_free (muv_t *A) |
Decomposes a matrix into sparse and low rank terms and do math operations.
struct muv_t |
Decompose an operator into a sparse operator and optional low rank terms. M-U*V'; M is usually symmetrical.
Data Fields | ||
---|---|---|
cell * | M |
block sparse matrix or dense matrix |
dcell * | U |
low rank terms U |
dcell * | V |
low rank terms V |
exfun_t | exfun |
Optionally attach an extra function that applies extra data |
void * | extra |
Data used by fun to apply: (*exfun)(y,extra,x,alpha) to compute |
spchol * | C |
Cholesky factor. |
dmat * | Up |
\(M^{-1}U\) |
dmat * | Vp |
\(M^{-1}[V*(I-Up'*V)^{-1}]\) |
dmat * | MI |
Inverse of M via svd |
dcell * | MIB |
Inverse of each diagonal element of M via svd |
spchol ** | CB |
Cholesky factor of each diagonal element of M |
dcell * | UpB |
Up for each diagonal component |
dcell * | VpB |
Vp for each diagonal component |
int | nb |
Number of blocks in CB; |
cgfun_t | Mfun |
Do M*x with a function |
cgfun_t | Mtfun |
Do M'*x with a function |
void * | Mdata |
Parameter to Mfun |
prefun_t | pfun |
The preconditioner function |
void * | pdata |
The precondtioner data |
int | alg |
The algorithm: 0: CBS, 1: CG, 2: SVD |
int | bgs |
Whether use BGS (Block Gauss Seidel) method, and how many iterations |
int | warm |
Whether use warm restart |
int | maxit |
How many iterations |
typedef void(* exfun_t) (dcell **xout, const void *A, const dcell *xin, const real alpha, int xb, int yb) |
Avoid function casting. It will hide data safety check and hide bugs.
Decomposes a matrix into sparse and low rank terms and do math operations.
The forward operations can be represented by a matrix M and two low rank terms as y = ( M - u*v' ) *x , or by a function Mfun and corresponding argument Mdata.
This can also be used to solve linear equations using muv_solve() or muv_bgs_solve(). Apply the sparse plus low rank compuation to xin with scaling of alpha: \(xout=(A.M-A.U*A.V')*xin*alpha\); U,V are low rank.
Apply the transpose of operation muv(); Apply the sparse plug low rand compuation to xin with scaling of alpha: \(xout=(A.M-A.V*A.U')*xin*alpha\); U,V are low rank.
Apply the sparse plus low rand compuation to xin with scaling of alpha for block (xb, yb): \(xout_x=(A.M_xy-A.U_xi*A.V_yi')*xin_y*alpha\); U,V are low rank.
convert the data from dcell to dmat and apply muv_direct_solve() . May be done in place.
Apply CBS or SVD multiply to xin to get xout. Create xout is not exist already. xout = A^-1 * xin; xin and xout can be the same for in place operation.
void muv_direct_prep | ( | muv_t * | A, |
real | svd | ||
) |
Cholesky factorization (svd=0) or svd (svd>0) on the sparse matrix and its low rank terms. if svd is less than 1, it is also used as the threshold in SVD inversion.
When there are low rank terms,
\[ Up=M^{-1}*U, Vp=M^{-1}*[V*(I-Up'*V)^{-1}] \]
void muv_direct_free | ( | muv_t * | A | ) |
Free cholesky decompositions or SVD.
Apply cholesky backsubstitution solve to xin to get xout. Create xout is not exist already. xin and xout can be the same for in place operation.
solve A*x=b using the Block Gauss Seidel algorithm. The matrix is always assembled. We use routines from muv. to do the computation.
[in,out] | px | The output vector. input for warm restart. |
[in] | A | Contain info about the The left hand side matrix A |
[in] | b | The right hand side vector to solve |
solve x=A^-1*B*b using algorithms depend on algorithm, wrapper.
[in,out] | px | The output vector. input for warm restart. |
[in] | L | Contain info about the left hand side matrix A |
[in] | R | Contain info about the right hand side matrix B |
[in] | b | The right hand side vector to solve. null is special case |
Apply CBS or SVD multiply to square sparse matrix. xout = A^-1 * xin * (A^-1)^T. The output is dmat if using SVD, and dsp if using CBS.
void muv_direct_diag_prep | ( | muv_t * | A, |
real | svd | ||
) |
Cholesky factorization (svd=0) or svd (svd>0) on each diagonal element of the block sparse matrix and its low rank terms. if svd is less than 1, it is also used as the threshold in SVD inversion.
When there are low rank terms,
\[ Up=M^{-1}U, Vp=M^{-1}[V*(I-Up'*V)^{-1}] \]
For each diagonal block.
void muv_direct_diag_free | ( | muv_t * | A | ) |
Free cholesky decompositions or SVD.