yasfpy.solver ============= .. py:module:: yasfpy.solver .. autoapi-nested-parse:: Iterative linear solvers used by YASF. The :class:`~yasfpy.solver.Solver` class wraps SciPy's iterative sparse solvers and provides a unified interface for use inside :class:`~yasfpy.simulation.Simulation`. Classes ------- .. autoapisummary:: yasfpy.solver.Solver yasfpy.solver.GMResCounter Module Contents --------------- .. py:class:: 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. .. py:attribute:: type :value: '' .. py:attribute:: tolerance :value: 0.0001 .. py:attribute:: max_iter :value: 0 .. py:attribute:: restart :value: 0 .. py:attribute:: preconditioner :value: None .. py:attribute:: warm_start :value: True .. py:attribute:: log .. py:method:: run(a, b, x0 = None) Runs the solver on the given linear system of equations. :param a: The linear operator representing the system matrix. :type a: LinearOperator :param b: The right-hand side vector. :type b: np.ndarray :param x0: The initial guess for the solution. If not provided, a copy of b will be used. :type x0: np.ndarray, optional :returns: The solution to the linear system of equations. err_code (int): The error code indicating the convergence status of the solver. :rtype: value (np.ndarray) .. py:class:: GMResCounter(disp = False, callback_type = 'pr_norm') Bases: :py:obj:`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. .. py:attribute:: log .. py:attribute:: niter :value: 0