bw2calc.jacobi_gmres_lca#

Classes#

JacobiGMRESLCA

Solve Ax=b with GMRES using a Jacobi preconditioner.

Module Contents#

class bw2calc.jacobi_gmres_lca.JacobiGMRESLCA(*args, rtol: float = 1e-08, atol: float = 0.0, restart: int | None = 50, maxiter: int | None = 300, use_guess: bool = True, **kwargs)[source]#

Bases: bw2calc.lca.LCA

Solve Ax=b with GMRES using a Jacobi preconditioner.

The preconditioner is the inverse of the technosphere diagonal, i.e. D^-1. This prior decomposition can significantly improve convergence for certain types of matrices, especially those with dominant diagonal entries.

Parameters:
  • demand (dict) – Functional unit mapping passed through to bw2calc.lca.LCA.

  • data_objs (iterable) – Datapackages passed through to bw2calc.lca.LCA.

  • rtol (float) – Relative tolerance for GMRES convergence. Convergence is checked against a threshold comparable to max(rtol * ||b||, atol).

  • atol (float) – Absolute tolerance floor for GMRES convergence.

  • restart (int or None) – Number of iterations between GMRES restarts. None uses SciPy defaults.

  • maxiter (int or None) – Maximum number of outer GMRES iterations.

  • use_guess (bool) – If True, reuse the previous solution as x0 for subsequent solves in the same instance.

_build_jacobi_preconditioner() scipy.sparse.linalg.LinearOperator | None[source]#
_prepare_matrix() None[source]#
load_lci_data(nonsquare_ok=False) None[source]#
solve_linear_system(demand: numpy.ndarray | None = None) numpy.ndarray[source]#
_cached_preconditioner: scipy.sparse.linalg.LinearOperator | None = None[source]#
_matrix_prepared = False[source]#
atol = 0.0[source]#
guess = None[source]#
maxiter = 300[source]#
restart = 50[source]#
rtol = 1e-08[source]#
use_guess = True[source]#