cagpjax.solvers.base
Base classes for linear solvers and methods.
Classes:
-
AbstractLinearSolver–Base class for linear solvers.
AbstractLinearSolver
Bases: Module, Generic[_LinearSolverState]
Base class for linear solvers.
These solvers are used to exactly or approximately solve the linear system \(Ax = b\) for \(x\), where \(A\) is a positive (semi-)definite (PSD) linear operator.
Methods:
-
init–Construct a solver state.
-
inv_congruence_transform–Compute the inverse congruence transform \(B^T x\) for \(x\) in \(Ax = B\).
-
inv_quad–Compute the inverse quadratic form \(b^T x\), for \(x\) in \(Ax = b\).
-
logdet–Compute the logarithm of the (pseudo-)determinant of \(A\).
-
solve–Compute a solution to the linear system \(Ax = b\).
-
trace_solve–Compute \(\mathrm{trace}(X)\) in \(AX=B\) for PSD \(A\) and \(B\).
-
unwhiten–Given an IID standard normal vector \(z\), return \(x\) with covariance \(A\).
init
abstractmethod
Construct a solver state.
Parameters:
-
(ALinearOperator) –Positive (semi-)definite linear operator.
Returns:
-
_LinearSolverState–State of the linear solver, which stores any necessary intermediate values.
Source code in src/cagpjax/solvers/base.py
inv_congruence_transform
abstractmethod
inv_congruence_transform(state: _LinearSolverState, B: LinearOperator | Float[Array, 'N K']) -> LinearOperator | Float[Array, 'K K']
Compute the inverse congruence transform \(B^T x\) for \(x\) in \(Ax = B\).
Parameters:
-
(state_LinearSolverState) –State of the linear solver returned by
init. -
(BLinearOperator | Float[Array, 'N K']) –Linear operator or array to be applied.
Returns:
-
LinearOperator | Float[Array, 'K K']–Linear operator or array resulting from the congruence transform.
Source code in src/cagpjax/solvers/base.py
inv_quad
Compute the inverse quadratic form \(b^T x\), for \(x\) in \(Ax = b\).
Parameters:
-
(state_LinearSolverState) –State of the linear solver returned by
init. -
(bFloat[Array, N]) –Right-hand side of the linear system.
Source code in src/cagpjax/solvers/base.py
logdet
abstractmethod
Compute the logarithm of the (pseudo-)determinant of \(A\).
Parameters:
-
(state_LinearSolverState) –State of the linear solver returned by
init.
solve
abstractmethod
Compute a solution to the linear system \(Ax = b\).
Parameters:
-
(state_LinearSolverState) –State of the linear solver returned by
init. -
(bFloat[Array, N]) –Right-hand side of the linear system.
Source code in src/cagpjax/solvers/base.py
trace_solve
abstractmethod
Compute \(\mathrm{trace}(X)\) in \(AX=B\) for PSD \(A\) and \(B\).
Parameters:
-
(state_LinearSolverState) –State of the linear solver obtained by applying
initto an operator representing \(A\) -
(state_other_LinearSolverState) –Another state obtained by applying
initto an operator representing \(B\).
Source code in src/cagpjax/solvers/base.py
unwhiten
abstractmethod
Given an IID standard normal vector \(z\), return \(x\) with covariance \(A\).
Parameters:
-
(state_LinearSolverState) –State of the linear solver returned by
init. -
(zFloat[Array, N]) –IID standard normal vector.