yasfpy.solver#

Iterative linear solvers used by YASF.

The Solver class wraps SciPy’s iterative sparse solvers and provides a unified interface for use inside Simulation.

Classes#

Solver

The Solver class provides a generic interface for solving linear systems of equations using

GMResCounter

The GMResCounter class is a helper class that counts the number of iterations and displays the

Module Contents#

class yasfpy.solver.Solver(solver_type='gmres', tolerance=0.0001, max_iter=10000.0, restart=100.0, preconditioner=None, *, warm_start=True)#

The Solver class provides a generic interface for solving linear systems of equations using different iterative solvers such as GMRES, BiCGSTAB, and LGMRES, and the GMResCounter class is used to count the number of iterations and display the residual or current iterate during the GMRES solver.

type = ''#
tolerance = 0.0001#
max_iter = 0#
restart = 0#
preconditioner = None#
warm_start = True#
log#
run(a, b, x0=None)#

Runs the solver on the given linear system of equations.

Parameters:
  • a (LinearOperator) – The linear operator representing the system matrix.

  • b (np.ndarray) – The right-hand side vector.

  • x0 (np.ndarray, optional) – The initial guess for the solution. If not provided, a copy of b will be used.

Returns:

The solution to the linear system of equations. err_code (int): The error code indicating the convergence status of the solver.

Return type:

value (np.ndarray)

class yasfpy.solver.GMResCounter(disp=False, callback_type='pr_norm')#

Bases: object

The GMResCounter class is a helper class that counts the number of iterations and displays the residual or current iterate during the GMRES solver.

log#
niter = 0#