.. Copyright 2021 IRT Saint-Exupéry, https://www.irt-saintexupery.com This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. .. _gen_linear_solver_algos: Linear solver algorithms ======================== .. warning:: Some algorithms may require the :ref:`installation ` of |g| with :ref:`all its features ` and some others may depend on :ref:`plugins `. .. note:: All the features of the wrapped optimization libraries may not be exposed through |g|. .. raw:: html .. _BICG_options: BICG ---- Module: :class:`gemseo.algos.linear_solvers.lib_scipy_linalg` Linear solver implemented in the SciPy library. More details about the algorithm and its options on https://docs.scipy.org/doc/scipy/reference/generated/BICG.html. .. raw:: html
Optional parameters
  • **atol** : *float | None, optional* The absolute tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to None. .. raw:: html
  • **inner_m** : *int, optional* By default it is set to 30. .. raw:: html
  • **max_iter** : *int, optional* The maximum number of iterations. By default it is set to 1000. .. raw:: html
  • **outer_k** : *int, optional* The number of vectors to carry between inner GMRES iterations. By default it is set to 3. .. raw:: html
  • **outer_v** : *list[tuple] | None, optional* The data used to augment the Krylov subspace. By default it is set to None. .. raw:: html
  • **preconditioner** : *ndarray | LinearOperator | None, optional* The preconditionner, approximation of RHS^-1. If None, no preconditioner is used. By default it is set to None. .. raw:: html
  • **prepend_outer_v** : *bool, optional* Whether to put outer_v augmentation vectors before the Krylov iterates. By default it is set to False. .. raw:: html
  • **save_when_fail** : *bool, optional* Whether to save the linear system to the disk when the solver failed to converge. By default it is set to False. .. raw:: html
  • **store_outer_av** : *bool, optional* By default it is set to True. .. raw:: html
  • **store_residuals** : *bool, optional* Whether to store the residuals convergence history. By default it is set to False. .. raw:: html
  • **tol** : *float, optional* The relative tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to 1e-12. .. raw:: html
  • **use_ilu_precond** : *bool, optional* Whether to use superLU to compute an incomplete LU factorization as preconditioner. By default it is set to True. .. raw:: html
  • **x0** : *ndarray | None, optional* The initial guess for the solution. M{sparse matrix, dense matrix, LinearOperator}. If None, solvers usually start from the null vector. inner_m int: The number of inner GMRES iterations per outer iteration. By default it is set to None. .. raw:: html
.. _BICGSTAB_options: BICGSTAB -------- Module: :class:`gemseo.algos.linear_solvers.lib_scipy_linalg` Linear solver implemented in the SciPy library. More details about the algorithm and its options on https://docs.scipy.org/doc/scipy/reference/generated/BICGSTAB.html. .. raw:: html
Optional parameters
  • **atol** : *float | None, optional* The absolute tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to None. .. raw:: html
  • **inner_m** : *int, optional* By default it is set to 30. .. raw:: html
  • **max_iter** : *int, optional* The maximum number of iterations. By default it is set to 1000. .. raw:: html
  • **outer_k** : *int, optional* The number of vectors to carry between inner GMRES iterations. By default it is set to 3. .. raw:: html
  • **outer_v** : *list[tuple] | None, optional* The data used to augment the Krylov subspace. By default it is set to None. .. raw:: html
  • **preconditioner** : *ndarray | LinearOperator | None, optional* The preconditionner, approximation of RHS^-1. If None, no preconditioner is used. By default it is set to None. .. raw:: html
  • **prepend_outer_v** : *bool, optional* Whether to put outer_v augmentation vectors before the Krylov iterates. By default it is set to False. .. raw:: html
  • **save_when_fail** : *bool, optional* Whether to save the linear system to the disk when the solver failed to converge. By default it is set to False. .. raw:: html
  • **store_outer_av** : *bool, optional* By default it is set to True. .. raw:: html
  • **store_residuals** : *bool, optional* Whether to store the residuals convergence history. By default it is set to False. .. raw:: html
  • **tol** : *float, optional* The relative tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to 1e-12. .. raw:: html
  • **use_ilu_precond** : *bool, optional* Whether to use superLU to compute an incomplete LU factorization as preconditioner. By default it is set to True. .. raw:: html
  • **x0** : *ndarray | None, optional* The initial guess for the solution. M{sparse matrix, dense matrix, LinearOperator}. If None, solvers usually start from the null vector. inner_m int: The number of inner GMRES iterations per outer iteration. By default it is set to None. .. raw:: html
.. _DEFAULT_options: DEFAULT ------- Module: :class:`gemseo.algos.linear_solvers.lib_scipy_linalg` This starts by LGMRES, but if it fails, switches to GMRES, then direct method super LU factorization. More details about the algorithm and its options on https://docs.scipy.org/doc/scipy/reference/generated/DEFAULT.html. .. raw:: html
Optional parameters
  • **atol** : *float | None, optional* The absolute tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to None. .. raw:: html
  • **inner_m** : *int, optional* By default it is set to 30. .. raw:: html
  • **max_iter** : *int, optional* The maximum number of iterations. By default it is set to 1000. .. raw:: html
  • **outer_k** : *int, optional* The number of vectors to carry between inner GMRES iterations. By default it is set to 3. .. raw:: html
  • **outer_v** : *list[tuple] | None, optional* The data used to augment the Krylov subspace. By default it is set to None. .. raw:: html
  • **preconditioner** : *ndarray | LinearOperator | None, optional* The preconditionner, approximation of RHS^-1. If None, no preconditioner is used. By default it is set to None. .. raw:: html
  • **prepend_outer_v** : *bool, optional* Whether to put outer_v augmentation vectors before the Krylov iterates. By default it is set to False. .. raw:: html
  • **save_when_fail** : *bool, optional* Whether to save the linear system to the disk when the solver failed to converge. By default it is set to False. .. raw:: html
  • **store_outer_av** : *bool, optional* By default it is set to True. .. raw:: html
  • **store_residuals** : *bool, optional* Whether to store the residuals convergence history. By default it is set to False. .. raw:: html
  • **tol** : *float, optional* The relative tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to 1e-12. .. raw:: html
  • **use_ilu_precond** : *bool, optional* Whether to use superLU to compute an incomplete LU factorization as preconditioner. By default it is set to True. .. raw:: html
  • **x0** : *ndarray | None, optional* The initial guess for the solution. M{sparse matrix, dense matrix, LinearOperator}. If None, solvers usually start from the null vector. inner_m int: The number of inner GMRES iterations per outer iteration. By default it is set to None. .. raw:: html
.. _GMRES_options: GMRES ----- Module: :class:`gemseo.algos.linear_solvers.lib_scipy_linalg` Linear solver implemented in the SciPy library. More details about the algorithm and its options on https://docs.scipy.org/doc/scipy/reference/generated/GMRES.html. .. raw:: html
Optional parameters
  • **atol** : *float | None, optional* The absolute tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to None. .. raw:: html
  • **inner_m** : *int, optional* By default it is set to 30. .. raw:: html
  • **max_iter** : *int, optional* The maximum number of iterations. By default it is set to 1000. .. raw:: html
  • **outer_k** : *int, optional* The number of vectors to carry between inner GMRES iterations. By default it is set to 3. .. raw:: html
  • **outer_v** : *list[tuple] | None, optional* The data used to augment the Krylov subspace. By default it is set to None. .. raw:: html
  • **preconditioner** : *ndarray | LinearOperator | None, optional* The preconditionner, approximation of RHS^-1. If None, no preconditioner is used. By default it is set to None. .. raw:: html
  • **prepend_outer_v** : *bool, optional* Whether to put outer_v augmentation vectors before the Krylov iterates. By default it is set to False. .. raw:: html
  • **save_when_fail** : *bool, optional* Whether to save the linear system to the disk when the solver failed to converge. By default it is set to False. .. raw:: html
  • **store_outer_av** : *bool, optional* By default it is set to True. .. raw:: html
  • **store_residuals** : *bool, optional* Whether to store the residuals convergence history. By default it is set to False. .. raw:: html
  • **tol** : *float, optional* The relative tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to 1e-12. .. raw:: html
  • **use_ilu_precond** : *bool, optional* Whether to use superLU to compute an incomplete LU factorization as preconditioner. By default it is set to True. .. raw:: html
  • **x0** : *ndarray | None, optional* The initial guess for the solution. M{sparse matrix, dense matrix, LinearOperator}. If None, solvers usually start from the null vector. inner_m int: The number of inner GMRES iterations per outer iteration. By default it is set to None. .. raw:: html
.. _LGMRES_options: LGMRES ------ Module: :class:`gemseo.algos.linear_solvers.lib_scipy_linalg` Linear solver implemented in the SciPy library. More details about the algorithm and its options on https://docs.scipy.org/doc/scipy/reference/generated/LGMRES.html. .. raw:: html
Optional parameters
  • **atol** : *float | None, optional* The absolute tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to None. .. raw:: html
  • **inner_m** : *int, optional* By default it is set to 30. .. raw:: html
  • **max_iter** : *int, optional* The maximum number of iterations. By default it is set to 1000. .. raw:: html
  • **outer_k** : *int, optional* The number of vectors to carry between inner GMRES iterations. By default it is set to 3. .. raw:: html
  • **outer_v** : *list[tuple] | None, optional* The data used to augment the Krylov subspace. By default it is set to None. .. raw:: html
  • **preconditioner** : *ndarray | LinearOperator | None, optional* The preconditionner, approximation of RHS^-1. If None, no preconditioner is used. By default it is set to None. .. raw:: html
  • **prepend_outer_v** : *bool, optional* Whether to put outer_v augmentation vectors before the Krylov iterates. By default it is set to False. .. raw:: html
  • **save_when_fail** : *bool, optional* Whether to save the linear system to the disk when the solver failed to converge. By default it is set to False. .. raw:: html
  • **store_outer_av** : *bool, optional* By default it is set to True. .. raw:: html
  • **store_residuals** : *bool, optional* Whether to store the residuals convergence history. By default it is set to False. .. raw:: html
  • **tol** : *float, optional* The relative tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to 1e-12. .. raw:: html
  • **use_ilu_precond** : *bool, optional* Whether to use superLU to compute an incomplete LU factorization as preconditioner. By default it is set to True. .. raw:: html
  • **x0** : *ndarray | None, optional* The initial guess for the solution. M{sparse matrix, dense matrix, LinearOperator}. If None, solvers usually start from the null vector. inner_m int: The number of inner GMRES iterations per outer iteration. By default it is set to None. .. raw:: html
.. _PETSC_KSP_options: PETSC_KSP --------- .. note:: The plugin `gemseo_petsc `_ is required. Module: :class:`gemseo_petsc.linear_solvers.ksp_lib` .. raw:: html
Optional parameters
  • **atol** : *float, optional* The absolute convergence tolerance of the (possibly preconditioned) residual norm. By default it is set to 1e-50. .. raw:: html
  • **dtol** : *float, optional* The divergence tolerance, e.g. the amount the (possibly preconditioned) residual norm can increase. By default it is set to 100000.0. .. raw:: html
  • **ksp_pre_processor** : *bool | None, optional* A callback function that is called with (KSP problem, options dict) as arguments before calling ksp.solve(). It allows the user to obtain an advanced configuration that is not supported by the current wrapper. If None, do not perform any call. By default it is set to None. .. raw:: html
  • **max_iter** : *int, optional* The maximum number of iterations. By default it is set to 100000. .. raw:: html
  • **monitor_residuals** : *bool, optional* Whether to store the residuals during convergence. WARNING: as said in Petsc documentation, "the routine is slow and should be used only for testing or convergence studies, not for timing." By default it is set to False. .. raw:: html
  • **options_cmd** : *dict[str, Any] | None, optional* The options to pass to the PETSc KSP solver. If None, use the default options. By default it is set to None. .. raw:: html
  • **preconditioner_type** : *str, optional* The type of the precondtioner, see `https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/petsc4py.PETSc.PC.Type-class.html`_ # noqa: B950 By default it is set to ilu. .. raw:: html
  • **set_from_options** : *bool, optional* Whether the options are set from sys.argv, a classical Petsc configuration mode. By default it is set to False. .. raw:: html
  • **solver_type** : *str, optional* The KSP solver type. See `https://petsc.org/release/docs/manualpages/KSP/KSPType.html#KSPType`_ By default it is set to gmres. .. raw:: html
  • **tol** : *float, optional* The relative convergence tolerance, relative decrease in the (possibly preconditioned) residual norm. By default it is set to 1e-05. .. raw:: html
  • **view_config** : *bool, optional* Whether to call ksp.view() to view the configuration of the solver before run. By default it is set to False. .. raw:: html
.. _QMR_options: QMR --- Module: :class:`gemseo.algos.linear_solvers.lib_scipy_linalg` Linear solver implemented in the SciPy library. More details about the algorithm and its options on https://docs.scipy.org/doc/scipy/reference/generated/QMR.html. .. raw:: html
Optional parameters
  • **atol** : *float | None, optional* The absolute tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to None. .. raw:: html
  • **inner_m** : *int, optional* By default it is set to 30. .. raw:: html
  • **max_iter** : *int, optional* The maximum number of iterations. By default it is set to 1000. .. raw:: html
  • **outer_k** : *int, optional* The number of vectors to carry between inner GMRES iterations. By default it is set to 3. .. raw:: html
  • **outer_v** : *list[tuple] | None, optional* The data used to augment the Krylov subspace. By default it is set to None. .. raw:: html
  • **preconditioner** : *ndarray | LinearOperator | None, optional* The preconditionner, approximation of RHS^-1. If None, no preconditioner is used. By default it is set to None. .. raw:: html
  • **prepend_outer_v** : *bool, optional* Whether to put outer_v augmentation vectors before the Krylov iterates. By default it is set to False. .. raw:: html
  • **save_when_fail** : *bool, optional* Whether to save the linear system to the disk when the solver failed to converge. By default it is set to False. .. raw:: html
  • **store_outer_av** : *bool, optional* By default it is set to True. .. raw:: html
  • **store_residuals** : *bool, optional* Whether to store the residuals convergence history. By default it is set to False. .. raw:: html
  • **tol** : *float, optional* The relative tolerance for convergence, norm(RHS.dot(sol)) <= max(tol*norm(LHS), atol). By default it is set to 1e-12. .. raw:: html
  • **use_ilu_precond** : *bool, optional* Whether to use superLU to compute an incomplete LU factorization as preconditioner. By default it is set to True. .. raw:: html
  • **x0** : *ndarray | None, optional* The initial guess for the solution. M{sparse matrix, dense matrix, LinearOperator}. If None, solvers usually start from the null vector. inner_m int: The number of inner GMRES iterations per outer iteration. By default it is set to None. .. raw:: html