use super::c64; use super::time_evolution::State; use ndarray::prelude::*; pub struct TwoLevel { state: Array1, } impl TwoLevel { pub fn new(alpha: c64, beta: c64) -> TwoLevel { TwoLevel { state: array![alpha, beta], } } } impl State for TwoLevel { fn fibrate(&self) -> Vec { self.state.iter() .flat_map(|c| std::iter::once(c.re).chain(std::iter::once(c.im))) .collect() } fn evolve(mut self, t: f64) -> Self { self.state = self.state.dot(&G::gen(t)); self } }