diffsol-la 0.3.0

Linear algebra traits and backends (vectors, matrices, linear solvers) for diffsol.
Documentation
use faer::Par;

/// Context for the faer backend.
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct FaerContext {
    pub par: Par,
    nbatch: usize,
}

impl FaerContext {
    pub fn new() -> Self {
        Self {
            par: Par::Seq,
            nbatch: 1,
        }
    }

    pub fn with_nbatch(nbatch: usize) -> Self {
        assert!(nbatch > 0, "nbatch must be > 0");
        Self {
            par: Par::Seq,
            nbatch,
        }
    }
}

impl Default for FaerContext {
    fn default() -> Self {
        Self::new()
    }
}

impl crate::Context for FaerContext {
    fn nbatch(&self) -> usize {
        self.nbatch
    }

    fn clone_with_nbatch(&self, nbatch: usize) -> Result<Self, crate::LaError> {
        assert!(nbatch > 0, "nbatch must be > 0");
        Ok(Self {
            par: self.par,
            nbatch,
        })
    }
}