Skip to main content

LinearSolver

Trait LinearSolver 

Source
pub trait LinearSolver<M: Matrix>: Default {
    // Required methods
    fn set_linearisation<C: LinearOp<V = M::V, T = M::T, M = M, C = M::C>>(
        &mut self,
        op: &C,
    );
    fn set_sparsity<C: LinearOp<V = M::V, T = M::T, M = M, C = M::C>>(
        &mut self,
        op: &C,
    );
    fn solve_in_place(&self, b: &mut M::V) -> Result<(), LaError>;

    // Provided method
    fn solve(&self, b: &M::V) -> Result<M::V, LaError> { ... }
}
Expand description

A solver for the linear problem Ax = b, where A is a LinearOp.

Required Methods§

Source

fn set_linearisation<C: LinearOp<V = M::V, T = M::T, M = M, C = M::C>>( &mut self, op: &C, )

Set the point at which the linear operator A is evaluated and factorise it.

The operator is assumed to have the same sparsity as that given to Self::set_sparsity.

Source

fn set_sparsity<C: LinearOp<V = M::V, T = M::T, M = M, C = M::C>>( &mut self, op: &C, )

Set the sparsity of the problem to be solved, any previous problem is discarded.

Any internal state of the solver is reset. This function will normally set the sparsity pattern of the matrix to be solved.

Source

fn solve_in_place(&self, b: &mut M::V) -> Result<(), LaError>

Provided Methods§

Source

fn solve(&self, b: &M::V) -> Result<M::V, LaError>

Solve the problem Ax = b and return the solution x.

Panics if Self::set_linearisation has not been called previously.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T: FaerScalar> LinearSolver<FaerMat<T>> for diffsol_la::linear_solver::faer::lu::LU<T>

Source§

impl<T: FaerScalar> LinearSolver<FaerSparseMat<T>> for FaerSparseLU<T>

Source§

impl<T: NalgebraScalar> LinearSolver<NalgebraMat<T>> for diffsol_la::linear_solver::nalgebra::lu::LU<T>