Trait LinearSolverBackend
pub trait LinearSolverBackend<S = f64>: Debug + Sync {
// Required methods
fn provider(&self) -> SolverProvider;
fn capabilities(&self) -> SolverCapabilities;
fn solve_with_execution(
&self,
problem: &LinearProblem<'_, S>,
plan: SolverPlan,
execution: &dyn ReplicatedLinearExecution,
) -> Result<LinearSolution<S>, Diagnostic>;
// Provided methods
fn id(&self) -> BackendId { ... }
fn complex_backend(&self) -> Option<&dyn LinearSolverBackend<Complex<f64>>> { ... }
fn require_hermitian_eigenproblem(
&self,
_problem: &HermitianEigenproblem<'_>,
) -> Result<(), Diagnostic> { ... }
fn hermitian_eigenpairs(
&self,
problem: &HermitianEigenproblem<'_>,
) -> Result<Vec<(ValueLiteral, ValueLiteral)>, Diagnostic> { ... }
fn prepare_linear(
&self,
_plan: SolverPlan,
) -> Result<Option<Box<dyn PreparedLinearSolver<S>>>, Diagnostic> { ... }
fn default_execution(&self) -> ExecutionReport { ... }
fn solve(
&self,
problem: &LinearProblem<'_, S>,
plan: SolverPlan,
) -> Result<LinearSolution<S>, Diagnostic> { ... }
}Description
Backend-neutral solver execution boundary.
Required Methods§
fn provider(&self) -> SolverProvider
fn provider(&self) -> SolverProvider
Stable identity and declared release/dependency inventory of this provider.
fn capabilities(&self) -> SolverCapabilities
fn capabilities(&self) -> SolverCapabilities
Exact numerical policy admitted by this adapter.
fn solve_with_execution(
&self,
problem: &LinearProblem<'_, S>,
plan: SolverPlan,
execution: &dyn ReplicatedLinearExecution,
) -> Result<LinearSolution<S>, Diagnostic>
fn solve_with_execution( &self, problem: &LinearProblem<'_, S>, plan: SolverPlan, execution: &dyn ReplicatedLinearExecution, ) -> Result<LinearSolution<S>, Diagnostic>
Solve through one explicit replicated-vector execution.
Backends must consume the execution or reject it before numerical work; they must not silently run elsewhere and rewrite provenance afterward.
§Errors
Returns a stable diagnostic for incompatible execution, unsupported policy, invalid operator behavior, breakdown, non-convergence, or true-residual rejection.
Provided Methods§
fn id(&self) -> BackendId
fn id(&self) -> BackendId
Stable adapter identity used in evidence and diagnostics.
fn complex_backend(&self) -> Option<&dyn LinearSolverBackend<Complex<f64>>>
fn complex_backend(&self) -> Option<&dyn LinearSolverBackend<Complex<f64>>>
Borrow this provider’s optional binary64 complex linear implementation.
Common Plans use this typed boundary instead of substituting a solver based on a provider name. The returned implementation must have the same exact provider identity; its capabilities are admitted and rechecked independently of this adapter’s real capabilities. Absence rejects a complex execution profile before numerical work.
fn require_hermitian_eigenproblem(
&self,
_problem: &HermitianEigenproblem<'_>,
) -> Result<(), Diagnostic>
fn require_hermitian_eigenproblem( &self, _problem: &HermitianEigenproblem<'_>, ) -> Result<(), Diagnostic>
Admit the optional complete, dense, host binary64 Hermitian pencil path.
This is independent of RHS solver capabilities and of S: the pencil’s
exact types retain real/complex coefficients. Plans call this before
execution. Unsupported adapters reject without silently choosing another
provider or converting a complex problem to a real one.
fn hermitian_eigenpairs(
&self,
problem: &HermitianEigenproblem<'_>,
) -> Result<Vec<(ValueLiteral, ValueLiteral)>, Diagnostic>
fn hermitian_eigenpairs( &self, problem: &HermitianEigenproblem<'_>, ) -> Result<Vec<(ValueLiteral, ValueLiteral)>, Diagnostic>
Compute typed eigenpair candidates for the optional admitted dense path. The owning Plan must select modes and verify residual, normalization, orthogonality and convergence before exposing accepted Results.
fn prepare_linear(
&self,
_plan: SolverPlan,
) -> Result<Option<Box<dyn PreparedLinearSolver<S>>>, Diagnostic>
fn prepare_linear( &self, _plan: SolverPlan, ) -> Result<Option<Box<dyn PreparedLinearSolver<S>>>, Diagnostic>
Prepare provider-private state for repeated run-local solves.
None means the provider has no prepared implementation and the caller
executes every candidate through solve_with_execution. A returned
session must validate the complete structure identity and actual sparse
topology before reusing provider state.
§Errors
Returns a structured capability or policy diagnostic.
fn default_execution(&self) -> ExecutionReport
fn default_execution(&self) -> ExecutionReport
Placement of an ordinary solve, available before numerical work.
The default solve uses serial execution. Adapters that replace that
placement must report their actual execution here; explicit
solve_with_execution calls retain their separate requested placement.
fn solve(
&self,
problem: &LinearProblem<'_, S>,
plan: SolverPlan,
) -> Result<LinearSolution<S>, Diagnostic>
fn solve( &self, problem: &LinearProblem<'_, S>, plan: SolverPlan, ) -> Result<LinearSolution<S>, Diagnostic>
Solve one validated problem under the exact plan.
§Errors
Returns a stable diagnostic for unsupported policy, invalid operator behavior, breakdown, non-convergence, or true-residual rejection.