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
|
use super::c64;
use super::s_5_fibration::*;
use super::time_evolution::State;
use ndarray::prelude::*;
pub struct TwoXTwoLevel {
state: Array2<c64>,
}
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<f64> {
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<G: super::time_evolution::MatrixGen>(mut self, t: f64) -> Self {
self.state = self.state.dot(&G::gen(t));
self
}
}
|