Skip to main content

SolverEngine

Trait SolverEngine 

Source
pub trait SolverEngine: Send + Sync {
    // Required methods
    fn solve(
        &self,
        matrix: &CsrMatrix<f64>,
        rhs: &[f64],
        budget: &ComputeBudget,
    ) -> Result<SolverResult, SolverError>;
    fn estimate_complexity(
        &self,
        profile: &SparsityProfile,
        n: usize,
    ) -> ComplexityEstimate;
    fn algorithm(&self) -> Algorithm;
}
Expand description

Core trait that every solver algorithm must implement.

A SolverEngine accepts a sparse matrix system and a compute budget, returning either a SolverResult or a structured SolverError.

Required Methods§

Source

fn solve( &self, matrix: &CsrMatrix<f64>, rhs: &[f64], budget: &ComputeBudget, ) -> Result<SolverResult, SolverError>

Solve the linear system A x = b (or the equivalent iterative problem) subject to the given compute budget.

§Arguments
  • matrix - the sparse coefficient matrix.
  • rhs - the right-hand side vector b.
  • budget - resource limits for this invocation.
§Errors

Returns SolverError on non-convergence, numerical issues, budget exhaustion, or invalid input.

Source

fn estimate_complexity( &self, profile: &SparsityProfile, n: usize, ) -> ComplexityEstimate

Estimate the computational cost of solving the given system without actually performing the solve.

Implementations should use the SparsityProfile to make a fast, heuristic prediction.

Source

fn algorithm(&self) -> Algorithm

Return the algorithm identifier for this engine.

Implementors§