class probnum.linalg.solvers.BayesCG(stopping_criterion=<probnum.LambdaStoppingCriterion object>)

Bases: probnum.linalg.solvers.ProbabilisticLinearSolver

Bayesian conjugate gradient method.

Probabilistic linear solver taking prior information about the solution and choosing \(A\)-conjugate actions to gain information about the solution by projecting the current residual.

This code implements the method described in Cockayne et al. 1.


stopping_criterion (LinearSolverStoppingCriterion) – Stopping criterion determining when a desired terminal condition is met.



Cockayne, J. et al., A Bayesian Conjugate Gradient Method, Bayesian Analysis, 2019

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.

Return type

Tuple[LinearSystemBelief, LinearSolverState]


  • 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.

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.


solver_state – State of the probabilistic linear solver.

Return type

Generator[LinearSolverState, None, None]