Skip to main content

LaLinearOp

Trait LaLinearOp 

Source
pub trait LaLinearOp {
    type T: Scalar;
    type V: Vector<T = Self::T, C = Self::C>;
    type M: Matrix<T = Self::T, V = Self::V, C = Self::C>;
    type C: Context;

    // Required methods
    fn nrows(&self) -> usize;
    fn ncols(&self) -> usize;
    fn context(&self) -> &Self::C;
    fn matrix_inplace(&self, y: &mut Self::M);

    // Provided method
    fn sparsity(&self) -> Option<<Self::M as Matrix>::Sparsity> { ... }
}
Expand description

A linear operator A for use with the crate::LinearSolver trait.

This is a minimal, time-unaware description of a linear operator: it can report its shape and context, materialise itself as a matrix, and optionally provide a sparsity pattern. It is deliberately decoupled from the richer, time-aware operator traits in the diffsol crate.

A solver for Ax = b uses Self::sparsity to set up the matrix storage and Self::matrix_inplace to populate the matrix A prior to factorisation.

Required Associated Types§

Source

type T: Scalar

Source

type V: Vector<T = Self::T, C = Self::C>

Source

type M: Matrix<T = Self::T, V = Self::V, C = Self::C>

Source

type C: Context

Required Methods§

Source

fn nrows(&self) -> usize

Number of rows of the operator (i.e. length of the output vector y).

Source

fn ncols(&self) -> usize

Number of columns of the operator (i.e. length of the input vector x).

Source

fn context(&self) -> &Self::C

The context associated with this operator.

Source

fn matrix_inplace(&self, y: &mut Self::M)

Compute the matrix representation of the operator A and store it in y.

y is assumed to have been initialised with the sparsity pattern returned by Self::sparsity.

Provided Methods§

Source

fn sparsity(&self) -> Option<<Self::M as Matrix>::Sparsity>

The sparsity pattern of the operator’s matrix, or None if dense.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C: NonLinearOpJacobian> LinearOp for LinearisedRef<'_, C>

Source§

type T = <C as Op>::T

Source§

type V = <C as Op>::V

Source§

type M = <C as Op>::M

Source§

type C = <C as Op>::C