diffsol_la/context/
nalgebra.rs1#[derive(Copy, Clone, Debug, PartialEq)]
3pub struct NalgebraContext {
4 nbatch: usize,
5}
6
7impl NalgebraContext {
8 pub fn new() -> Self {
9 Self { nbatch: 1 }
10 }
11
12 pub fn with_nbatch(nbatch: usize) -> Self {
13 assert!(nbatch > 0, "nbatch must be > 0");
14 Self { nbatch }
15 }
16}
17
18impl Default for NalgebraContext {
19 fn default() -> Self {
20 Self::new()
21 }
22}
23
24impl crate::Context for NalgebraContext {
25 fn nbatch(&self) -> usize {
26 self.nbatch
27 }
28
29 fn clone_with_nbatch(&self, nbatch: usize) -> Result<Self, crate::LaError> {
30 assert!(nbatch > 0, "nbatch must be > 0");
31 Ok(Self { nbatch })
32 }
33}