use super::c64; use super::s_5_fibration::*; use super::time_evolution::State; use ndarray::prelude::*; pub struct TwoXTwoLevel { state: Array2, } impl TwoXTwoLevel { pub fn new(alpha: c64, beta: c64, delta: c64, gamma: c64) -> TwoXTwoLevel { TwoXTwoLevel { state: array![[alpha], [beta], [gamma], [delta]], } } } impl State for TwoXTwoLevel { fn fibrate(&self) -> Vec { let mut conjugate = self .state .to_owned() .into_shape((4, 1)) .expect("Invalid shape cast during fibartion"); for val in conjugate.iter_mut() { *val = val.conj(); } let v = conjugate.dot(&X3().dot(&self.state))[(0, 0)]; vec![ conjugate.dot(&X0().dot(&self.state))[(0, 0)].re, conjugate.dot(&X1().dot(&self.state))[(0, 0)].re, conjugate.dot(&X2().dot(&self.state))[(0, 0)].re, v.re, v.im, ] } fn evolve(mut self, t: f64) -> Self { self.state = self.state.dot(&G::gen(t)); self } }