ConjugateGradient¶
- class itergp.methods.ConjugateGradient(precond_inv=None, maxiter=None, atol=1e-06, rtol=1e-06, reorthogonalization_fn_residual=<function gram_schmidt_double>)¶
Bases:
ProbabilisticLinearSolverConjugate Gradient method.
- Parameters
precond_inv – Preconditioner inverse.
maxiter – Maximum number of steps the solver should take. Defaults \(10n\), where \(n\) is the size of the linear system.
atol – Absolute tolerance.
rtol – Relative tolerance.
reorthogonalization_fn_residual – Reorthogonalization function, which takes a vector, an orthogonal basis and optionally an inner product and returns a reorthogonalized vector. If not None the residuals are reorthogonalized before the action is computed.
Methods Summary
solve(prior, problem[, rng])Solve the linear system.
solve_iterator(prior, problem[, rng])Generator implementing the solver iteration.
Methods Documentation
- solve(prior, problem, rng=None)¶
Solve the linear system.
- Parameters
prior (LinearSystemBelief) – Prior belief about the quantities of interest \((x, A, A^{-1}, b)\) of the linear system.
problem (LinearSystem) – Linear system to be solved.
- Returns
belief – Posterior belief \((\mathsf{x}, \mathsf{A}, \mathsf{H}, \mathsf{b})\) over the solution \(x\), the system matrix \(A\), its (pseudo-)inverse \(H=A^\dagger\) and the right hand side \(b\).
solver_state – Final state of the solver.
- Return type
- solve_iterator(prior, problem, rng=None)¶
Generator implementing the solver iteration.
This function allows stepping through the solver iteration one step at a time and exposes the internal solver state.
- Parameters
prior (LinearSystemBelief) – Prior belief about the quantities of interest \((x, A, A^{-1}, b)\) of the linear system.
problem (LinearSystem) – Linear system to be solved.
- Yields
solver_state – State of the probabilistic linear solver.
- Return type
Generator[LinearSolverState, None, None]