#[macro_export]
macro_rules! impl_ode_state_for_svector {
($($type:ident),*) => {
$(
impl<const N: usize> OdeState for $type<f64, N> {
fn add(&self, other: &Self) -> Self {
<Self as Vector<f64>>::add(self, other)
}
fn add_assign(&mut self, other: &Self) {
<Self as Vector<f64>>::add_assign(self, other);
}
fn sub(&self, other: &Self) -> Self {
<Self as Vector<f64>>::sub(self, other)
}
fn sub_assign(&mut self, other: &Self) {
<Self as Vector<f64>>::sub_assign(self, other);
}
fn mul(&self, scalar: f64) -> Self {
<Self as Vector<f64>>::mul(self, scalar)
}
fn mul_assign(&mut self, scalar: f64) {
<Self as Vector<f64>>::mul_assign(self, scalar);
}
fn get_state_variable(&self, index: StateIndex) -> f64 {
match index {
StateIndex::Scalar() => panic!("Cannot index a vector ODE state with a StateIndex::Scalar."),
StateIndex::Vector(i) => self[i],
StateIndex::Matrix(_, _) => panic!("Cannot index a vector ODE state with a StateIndex::Matrix.")
}
}
}
)*
};
}