MAOS
Multithreaded Adaptive Optics Simulator
|
Typedefs | |
typedef void(* | cgfun_t) (dcell **xout, const void *A, const dcell *xin, const real alpha) |
typedef void(* | prefun_t) (dcell **xout, const void *A, const dcell *xin) |
Functions | |
real | pcg (dcell **px, cgfun_t Amul, const void *A, prefun_t Mmul, const void *M, const dcell *b, int warm, int maxiter) |
Implements preconditioned conjugate gradient method.
real pcg | ( | dcell ** | px, |
cgfun_t | Amul, | ||
const void * | A, | ||
prefun_t | Mmul, | ||
const void * | M, | ||
const dcell * | b, | ||
int | warm, | ||
int | maxiter | ||
) |
solve A*x=b using (preconditioned) conjugate gradient method
; input x is first guess if not NULL and warm==1; A is symmetric positive definite (SPD) matrix plus low rand terms. x0 contains the initial guess. Amul is the operator that applies A to x.
[in,out] | px | The output vector. input for warm restart. |
[in] | Amul | The function that applies y=y+A*x*alpha: (*Amul)(&y,A,x,alpha) |
[in] | A | Contain info about the The left hand side matrix A |
[in] | Mmul | The precond func that applies y=M^-1*x; |
[in] | M | Contains info about preconditioner matrix M. |
[in] | b | The right hand side vector to solve |
[in] | warm | Use warm restart (use the value contained in px) |
[in] | maxiter | Max number of iterations |