summaryrefslogtreecommitdiff
path: root/src/simulation/two_level.rs
blob: 38a65d907e6fa8838d2a40f75198ba37b668d136 (plain)
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
use super::c64;
use super::time_evolution::State;
use ndarray::prelude::*;

pub struct TwoLevel {
    state: Array1<c64>,
}

impl TwoLevel {
    pub fn new(alpha: c64, beta: c64) -> TwoLevel {
        TwoLevel {
            state: array![alpha, beta],
        }
    }
}

impl State for TwoLevel {
    fn fibrate(&self) -> Array1<c64> {
        self.state.clone()
    }

    fn evolve<G: super::time_evolution::MatrixGen>(mut self, t: f64) -> Self {
        self.state = self.state.dot(&G::gen(t));
        self
    }
}