kryst 3.2.1

Krylov subspace and preconditioned iterative solvers for dense and sparse linear systems, with shared and distributed memory parallelism.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![cfg(feature = "backend-nalgebra")]

use crate::context::pc_context::PcConfig;
use crate::error::KError;
use crate::preconditioner::Preconditioner;

pub fn try_build(cfg: &PcConfig) -> Result<Option<Box<dyn Preconditioner>>, KError> {
    match cfg {
        PcConfig::Lu => Ok(Some(Box::new(
            crate::preconditioner::nalgebra_direct::NalgebraLuPc::new(),
        ))),
        PcConfig::Qr => Ok(Some(Box::new(
            crate::preconditioner::nalgebra_direct::NalgebraQrPc::new(),
        ))),
        _ => Ok(None),
    }
}