pub trait LinearOperator<F: Float> {
// Required methods
fn shape(&self) -> (usize, usize);
fn matvec(&self, x: &[F]) -> SparseResult<Vec<F>>;
// Provided methods
fn matmat(&self, x: &[Vec<F>]) -> SparseResult<Vec<Vec<F>>> { ... }
fn rmatvec(&self, _x: &[F]) -> SparseResult<Vec<F>> { ... }
fn rmatmat(&self, x: &[Vec<F>]) -> SparseResult<Vec<Vec<F>>> { ... }
fn has_adjoint(&self) -> bool { ... }
}
Expand description
Trait for representing a linear operator
This trait provides an abstract interface for linear operators, allowing matrix-free implementations and compositions.
Required Methods§
Sourcefn matvec(&self, x: &[F]) -> SparseResult<Vec<F>>
fn matvec(&self, x: &[F]) -> SparseResult<Vec<F>>
Apply the operator to a vector: y = A * x
Provided Methods§
Sourcefn matmat(&self, x: &[Vec<F>]) -> SparseResult<Vec<Vec<F>>>
fn matmat(&self, x: &[Vec<F>]) -> SparseResult<Vec<Vec<F>>>
Apply the operator to a matrix: Y = A * X where X is column-major (each column is a vector)
Sourcefn rmatvec(&self, _x: &[F]) -> SparseResult<Vec<F>>
fn rmatvec(&self, _x: &[F]) -> SparseResult<Vec<F>>
Apply the adjoint of the operator to a vector: y = A^H * x Default implementation returns an error
Sourcefn rmatmat(&self, x: &[Vec<F>]) -> SparseResult<Vec<Vec<F>>>
fn rmatmat(&self, x: &[Vec<F>]) -> SparseResult<Vec<Vec<F>>>
Apply the adjoint of the operator to a matrix: Y = A^H * X Default implementation calls rmatvec for each column
Sourcefn has_adjoint(&self) -> bool
fn has_adjoint(&self) -> bool
Check if the operator supports adjoint operations