MAOS
Multithreaded Adaptive Optics Simulator
pcg.h File Reference

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)
 

Detailed Description

Implements preconditioned conjugate gradient method.

Function Documentation

◆ pcg()

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.

Parameters
[in,out]pxThe output vector. input for warm restart.
[in]AmulThe function that applies y=y+A*x*alpha: (*Amul)(&y,A,x,alpha)
[in]AContain info about the The left hand side matrix A
[in]MmulThe precond func that applies y=M^-1*x;
[in]MContains info about preconditioner matrix M.
[in]bThe right hand side vector to solve
[in]warmUse warm restart (use the value contained in px)
[in]maxiterMax number of iterations