lib.MapMaking.Qcg module
- lib.MapMaking.Qcg.pcg(A, b[, x0, tol, maxiter, M, disp, callback, reuse_initial_state])[source]
- Parameters:
A ({Operator, sparse matrix, dense matrix}) – The real or complex N-by-N matrix of the linear system
Amust represent a hermitian, positive definite matrixb ({array, matrix}) – Right hand side of the linear system. Has shape (N,) or (N,1).
x0 ({array, matrix}) – Starting guess for the solution.
tol (float, optional) – Tolerance to achieve. The algorithm terminates when either the relative residual is below tol.
maxiter (integer, optional) – Maximum number of iterations. Iteration will stop after maxiter steps even if the specified tolerance has not been achieved.
M ({Operator, sparse matrix, dense matrix}, optional) – Preconditioner for A. The preconditioner should approximate the inverse of A. Effective preconditioning dramatically improves the rate of convergence, which implies that fewer iterations are needed to reach a given error tolerance.
disp (boolean) – Set to True to display convergence message
callback (function, optional) – User-supplied function to call after each iteration. It is called as callback(self), where self is an instance of this class.
reuse_initial_state (boolean, optional) – If set to True, the buffer initial guess (if provided) is reused during the iterations. Beware of side effects!
- Returns:
output – ‘x’ : the converged solution. ‘success’ : boolean indicating success ‘message’ : string indicating cause of failure ‘nit’ : number of completed iterations ‘error’ : normalized residual ||Ax-b|| / ||b|| ‘time’ : elapsed time in solver ‘algorithm’ : the PCGAlgorithm instance (the callback function has
access to it and can store information in it)
- Return type:
dict whose keys are