class probnum.linalg.MatrixBasedSolver(A, b, x0=None)

Bases: probnum.linalg.ProbabilisticLinearSolver, abc.ABC

Abstract class for matrix-based probabilistic linear solvers.

  • A (array-like or LinearOperator or RandomVariable, shape=(n,n)) – A square matrix or linear operator. A prior distribution can be provided as a RandomVariable. If an array or linear operator is given, a prior distribution is chosen automatically.
  • b (RandomVariable, shape=(n,) or (n, nrhs)) – Right-hand side vector, matrix or RandomVariable of \(A x = b\).
  • x0 (array-like, shape=(n,) or (n, nrhs)) – Optional. Guess for the solution of the linear system.

Methods Summary

has_converged(iter, maxiter, **kwargs) Check convergence of a linear solver.
solve([callback, maxiter, atol]) Solve the linear system \(Ax=b\).

Methods Documentation

has_converged(iter, maxiter, **kwargs)[source]

Check convergence of a linear solver.

Evaluates a set of convergence criteria based on its input arguments to decide whether the iteration has converged.

  • iter (int) – Current iteration of solver.
  • maxiter (int) – Maximum number of iterations

  • has_converged (bool) – True if the method has converged.
  • convergence_criterion (str) – Convergence criterion which caused termination.

solve(callback=None, maxiter=None, atol=None)[source]

Solve the linear system \(Ax=b\).

  • callback (function, optional) – User-supplied function called after each iteration of the linear solver. It is called as callback(xk, Ak, Ainvk, sk, yk, alphak, resid, **kwargs) and can be used to return quantities from the iteration. Note that depending on the function supplied, this can slow down the solver.
  • kwargs – Key-word arguments adjusting the behaviour of the solve iteration. These are usually convergence criteria.

  • x (RandomVariable, shape=(n,) or (n, nrhs)) – Approximate solution \(x\) to the linear system. Shape of the return matches the shape of b.
  • A (RandomVariable, shape=(n,n)) – Posterior belief over the linear operator.
  • Ainv (RandomVariable, shape=(n,n)) – Posterior belief over the linear operator inverse \(H=A^{-1}\).
  • info (dict) – Information on convergence of the solver.