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§
Sourcefn solve(
&self,
matrix: &CsrMatrix<f64>,
rhs: &[f64],
budget: &ComputeBudget,
) -> Result<SolverResult, SolverError>
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 vectorb.budget- resource limits for this invocation.
§Errors
Returns SolverError on non-convergence, numerical issues, budget
exhaustion, or invalid input.
Sourcefn estimate_complexity(
&self,
profile: &SparsityProfile,
n: usize,
) -> ComplexityEstimate
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.