Macro totsu_core::solver::splitm
source · macro_rules! splitm {
($slice:expr, $( ($var:ident; $len:expr) ),+ ) => { ... };
}
Expand description
Splits a SliceRef
into multiple ones.
use totsu_core::solver::{SliceLike, SliceRef, LinAlg};
use totsu_core::{splitm, FloatGeneric};
fn func<L: LinAlg>(x: SliceRef<L::Sl>) {
splitm!(x, (x1; 4), (x2; 5), (x3; 6));
assert_eq!(x1.len(), 4);
assert_eq!(x2.len(), 5);
assert_eq!(x3.len(), 6);
}
type L = FloatGeneric<f64>;
let a = &[0.; 20];
let x = <L as LinAlg>::Sl::new_ref(a);
func::<L>(x);