pub struct SolverRouter { /* private fields */ }Expand description
Stateless algorithm selector.
Given a SparsityProfile and a QueryType, the router walks a
decision tree (documented in the module-level docs) to pick the
Algorithm with the best expected cost.
§Example
use ruvector_solver::router::{SolverRouter, RouterConfig};
use ruvector_solver::types::{Algorithm, QueryType, SparsityProfile};
let router = SolverRouter::new(RouterConfig::default());
let profile = SparsityProfile {
rows: 500,
cols: 500,
nnz: 1200,
density: 0.0048,
is_diag_dominant: true,
estimated_spectral_radius: 0.4,
estimated_condition: 10.0,
is_symmetric_structure: true,
avg_nnz_per_row: 2.4,
max_nnz_per_row: 5,
};
let algo = router.select_algorithm(&profile, &QueryType::LinearSystem);
assert_eq!(algo, Algorithm::Neumann);Implementations§
Source§impl SolverRouter
impl SolverRouter
Sourcepub fn new(config: RouterConfig) -> Self
pub fn new(config: RouterConfig) -> Self
Create a new router with the provided configuration.
Sourcepub fn config(&self) -> &RouterConfig
pub fn config(&self) -> &RouterConfig
Return a shared reference to the active configuration.
Sourcepub fn select_algorithm(
&self,
profile: &SparsityProfile,
query: &QueryType,
) -> Algorithm
pub fn select_algorithm( &self, profile: &SparsityProfile, query: &QueryType, ) -> Algorithm
Select the optimal algorithm for the given matrix profile and query.
This is a pure function with no side effects – it does not touch the matrix data, only the precomputed profile.
Trait Implementations§
Source§impl Clone for SolverRouter
impl Clone for SolverRouter
Source§fn clone(&self) -> SolverRouter
fn clone(&self) -> SolverRouter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SolverRouter
impl Debug for SolverRouter
Auto Trait Implementations§
impl Freeze for SolverRouter
impl RefUnwindSafe for SolverRouter
impl Send for SolverRouter
impl Sync for SolverRouter
impl Unpin for SolverRouter
impl UnsafeUnpin for SolverRouter
impl UnwindSafe for SolverRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more