qttools.lyapunov#
source package qttools.lyapunov
Classes
-
LyapunovSolver — Solver interface for the discrete-time Lyapunov equation.
-
LyapunovMemoizer — Memoization class to reuse the result of an Lyapunov evaluation.
-
Doubling — A solver for the Lyapunov equation using iterative doubling.
-
Spectral — A solver for the Lyapunov equation by using the matrix spectrum.
source class LyapunovSolver()
Bases : ABC
Solver interface for the discrete-time Lyapunov equation.
The discrete-time Lyapunov equation is defined as:
source class LyapunovMemoizer(lyapunov_solver: LyapunovSolver, num_ref_iterations: int = 3, memoize_rel_tol: float = 0.2, memoize_abs_tol: float = 1e-06, warning_threshold: float = 1e-05, reduce_sparsity: bool = True, memoizing_mode: str = 'auto')
Memoization class to reuse the result of an Lyapunov evaluation.
Initializes the memoizer.
Parameters
-
lyapunov_solver : LyapunovSolver — The Lyapunov solver to wrap.
-
num_ref_iterations : int, optional — The number of refinement iterations to do.
-
memoize_rel_tol : float, optional — The required relative accuracy to only memoize.
-
memoize_abs_tol : float, optional — The required absolute accuracy to only memoize. If either of the tolerances is met, the result is memoized.
-
warning_threshold : float, optional — The threshold for the relative recursion error to issue a warning.
-
reduce_sparsity : bool, optional — Whether to reduce the sparsity of the system matrix. If sparsity of any obc is changed during runtime, then the cache needs to be invalidated.
-
memoizing_mode : str, optional — Possible modes are:
- 'auto': (default) automatically decide whether to memoize or recompute based on the recursion error.
- 'force': always memoize
- 'force-after-first': always memoize after the first call
- 'off': never memoize
source class Doubling(max_iterations: int = 10, convergence_rel_tol: float = 1e-05, convergence_abs_tol: float = 1e-08, reduce_sparsity: bool = True)
Bases : LyapunovSolver
A solver for the Lyapunov equation using iterative doubling.
Initializes the solver.
Parameters
-
max_iterations : int, optional — The maximum number of iterations to perform.
-
convergence_rel_tol : float, optional — The required relative accuracy for convergence.
-
convergence_abs_tol : float, optional — The required absolute accuracy for convergence. Either convergence_rel_tol or convergence_abs_tol must be satisfied.
-
reduce_sparsity : bool, optional — Whether to reduce the sparsity of the system matrix
source class Spectral(num_ref_iterations: int = 3, warning_threshold: float = 0.1, eig_compute_location: str = 'numpy', reduce_sparsity: bool = True, use_pinned_memory: bool = True)
Bases : LyapunovSolver
A solver for the Lyapunov equation by using the matrix spectrum.
Initializes the spectral Lyapunov solver.
Parameters
-
num_ref_iterations : int, optional — The number of refinement iterations to perform.
-
warning_threshold : float, optional — The threshold for the relative recursion error to issue a warning.
-
eig_compute_location : str, optional — The location where to compute the eigenvalues and eigenvectors. Can be either "numpy" or "cupy". Only relevant if cupy is used.
-
reduce_sparsity : bool, optional — Whether to reduce the sparsity of the system matrix.
-
use_pinned_memory : bool, optional — Whether to use pinnend memory if cupy is used. Default is
True
.