1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use ndarray::{RcArray, Dimension, LinalgScalar};
use std::ops::*;
pub trait EOM<A, D>
where D: Dimension
{
fn rhs(self, RcArray<A, D>) -> RcArray<A, D>;
}
pub trait Diag<A, D>
where D: Dimension
{
fn diagonal(&self) -> RcArray<A, D>;
}
pub trait TimeEvolution<A, D>
where D: Dimension
{
fn iterate(self, RcArray<A, D>) -> RcArray<A, D>;
}
pub trait TimeStep {
fn get_dt(&self) -> f64;
fn set_dt(&mut self, dt: f64);
}
pub trait OdeScalar<R: Ring>: LinalgScalar + RMod<R> {}
impl<A, R: Ring> OdeScalar<R> for A where A: LinalgScalar + RMod<R> {}
pub trait Ring
: Add<Output = Self> + Sub<Output = Self> + Mul<Output = Self> + Sized {
}
impl<A> Ring for A where A: Add<Output = A> + Sub<Output = A> + Mul<Output = A> + Sized {}
pub trait RMod<R: Ring>: Mul<R, Output = Self> + Sized {}
impl<A, R: Ring> RMod<R> for A where A: Mul<R, Output = A> + Sized {}