Skip to main content

SolverRegistry

Struct SolverRegistry 

Source
pub struct SolverRegistry { /* private fields */ }
Expand description

Registry for solver backends

Implementations§

Source§

impl SolverRegistry

Source

pub fn new() -> Self

Source

pub fn register(&mut self, factory: Box<dyn LinearSolverFactory>)

Source

pub fn get(&self, name: &str) -> Option<&dyn LinearSolverFactory>

Source

pub fn list(&self) -> Vec<String>

Source

pub fn list_sorted(&self) -> Vec<String>

Registered solver names, sorted (deterministic).

Source

pub fn create(&self, name: &str) -> Option<Box<dyn LinearSolver>>

Source

pub fn validate_selection( &self, name: &str, matrix: &SparseMatrix, ) -> Result<SolverCapabilities, SolverError>

Validate that the named backend can legally handle matrix, returning its capabilities on success. Performs no factorization.

§Errors
Source

pub fn select( &self, matrix: &SparseMatrix, selection: &SolverSelection, ) -> Result<SolverSelectionInfo, SolverError>

Decide which backend would be used, without constructing or factorizing anything. Answers “which solver, and why?”.

§Errors

Returns an error for an unknown explicit name, an incompatible matrix class, an empty matrix, or (for Auto) when no suitable backend exists.

Source

pub fn auto_select_info( &self, matrix: &SparseMatrix, ) -> Result<SolverSelectionInfo, SolverError>

The auto-selection policy, exposed as a decision (name + reason).

Policy (conservative; never selects a solver that cannot handle the detected matrix class):

  1. n <= 500 → dense (general, any class).
  2. symmetric with a positive diagonal (necessary condition for SPD) and within skyline’s size limit → skyline_ldlt (it verifies definiteness at factorization).
  3. pardiso only if a PARDISO factory is actually registered (never for the default registry, even with the feature enabled).
  4. otherwise → sparse_lu (general; handles symmetric or not).

Auto never selects cg/iccg. Unlike explicit selection, auto does not hard-reject on max_size: it treats the limit as a preference and still returns the only class-legal backend for very large systems.

cg/iccg are never auto-selected: their SPD requirement cannot be established reliably from the matrix alone.

Source

pub fn create_selected( &self, matrix: &SparseMatrix, selection: &SolverSelection, ) -> Result<Box<dyn LinearSolver>, SolverError>

Construct a solver for selection, after capability validation.

Explicit selections are authoritative: if the requested backend cannot legally handle the matrix (or is unknown / uncreatable), an error is returned and no other backend is substituted. Auto may pick any backend that can handle the matrix class.

The solver is returned unfactored — the caller calls LinearSolver::factor then LinearSolver::solve.

Source

pub fn auto_select( &self, matrix: &SparseMatrix, ) -> Option<Box<dyn LinearSolver>>

Backwards-compatible automatic selection: returns the chosen solver, or None if none is registered. Prefer Self::select / Self::create_selected for new code.

Trait Implementations§

Source§

impl Default for SolverRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.