#[cfg(feature = "sparse")]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum SparseSolverStrategy {
#[default]
Gmres,
DirectLU,
Auto,
}
#[cfg(feature = "sparse")]
#[derive(Debug, Clone)]
pub struct DirectSolverConfig {
pub pivot_tolerance: f64,
pub pivot_threshold: f64,
pub diagonal_shift: f64,
pub equilibrate: bool,
pub pivot_growth_threshold: f64,
}
#[cfg(feature = "sparse")]
impl Default for DirectSolverConfig {
fn default() -> Self {
Self {
pivot_tolerance: 1.0,
pivot_threshold: 1e-12,
diagonal_shift: 0.0,
equilibrate: false,
pivot_growth_threshold: 1e8,
}
}
}
#[cfg(feature = "sparse")]
impl DirectSolverConfig {
pub fn with_diagonal_shift(shift: f64) -> Self {
Self {
diagonal_shift: shift,
..Default::default()
}
}
pub fn relaxed_pivoting() -> Self {
Self {
pivot_tolerance: 0.1,
..Default::default()
}
}
pub fn with_equilibration() -> Self {
Self {
equilibrate: true,
..Default::default()
}
}
}