pub trait LinearOp: Op {
// Required method
fn gemv_inplace(
&self,
x: &Self::V,
t: Self::T,
beta: Self::T,
y: &mut Self::V,
);
// Provided methods
fn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V) { ... }
fn matrix(&self, t: Self::T) -> Self::M { ... }
fn matrix_inplace(&self, t: Self::T, y: &mut Self::M) { ... }
fn _default_matrix_inplace(&self, t: Self::T, y: &mut Self::M) { ... }
fn sparsity(&self) -> Option<<Self::M as Matrix>::Sparsity> { ... }
}
Expand description
LinearOp is a trait for linear operators (i.e. they only depend linearly on the input x
), see crate::NonLinearOp for a non-linear op.
An example of a linear operator is a matrix-vector product y = A(t) * x
, where A(t)
is a matrix.
It extends the Op trait with methods for calling the operator via a GEMV-like operation (i.e. y = t * A * x + beta * y
), and for computing the matrix representation of the operator.
Required Methods§
Provided Methods§
Sourcefn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V)
fn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V)
Compute the operator y = A(t) * x
at a given state and time, the default implementation uses Self::gemv_inplace.
Sourcefn matrix(&self, t: Self::T) -> Self::M
fn matrix(&self, t: Self::T) -> Self::M
Compute the matrix representation of the operator A(t)
and return it.
See Self::matrix_inplace for a non-allocating version.
Sourcefn matrix_inplace(&self, t: Self::T, y: &mut Self::M)
fn matrix_inplace(&self, t: Self::T, y: &mut Self::M)
Compute the matrix representation of the operator A(t)
and store it in the matrix y
.
The default implementation of this method computes the matrix using Self::gemv_inplace,
but it can be overriden for more efficient implementations.
Sourcefn _default_matrix_inplace(&self, t: Self::T, y: &mut Self::M)
fn _default_matrix_inplace(&self, t: Self::T, y: &mut Self::M)
Default implementation of the matrix computation, see Self::matrix_inplace.