summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/hamiltonians.rs31
-rw-r--r--src/simulation/mod.rs1
-rw-r--r--src/simulation/twoxtwo_level.rs3
3 files changed, 35 insertions, 0 deletions
diff --git a/src/simulation/hamiltonians.rs b/src/simulation/hamiltonians.rs
new file mode 100644
index 0000000..03d8d1f
--- /dev/null
+++ b/src/simulation/hamiltonians.rs
@@ -0,0 +1,31 @@
+use super::c64;
+use ndarray::prelude::*;
+
+pub fn X0() -> Array2<c64> {
+ array![
+ [
+ c64::new(1.0, 0.0),
+ c64::new(0.0, 0.0),
+ c64::new(0.0, 0.0),
+ c64::new(0.0, 0.0),
+ ],
+ [
+ c64::new(0.0, 0.0),
+ c64::new(1.0, 0.0),
+ c64::new(0.0, 0.0),
+ c64::new(0.0, 0.0),
+ ],
+ [
+ c64::new(0.0, 0.0),
+ c64::new(0.0, 0.0),
+ c64::new(-1.0, 0.0),
+ c64::new(0.0, 0.0),
+ ],
+ [
+ c64::new(0.0, 0.0),
+ c64::new(0.0, 0.0),
+ c64::new(0.0, 0.0),
+ c64::new(-1.0, 0.0),
+ ]
+ ]
+}
diff --git a/src/simulation/mod.rs b/src/simulation/mod.rs
index 641444e..c72f275 100644
--- a/src/simulation/mod.rs
+++ b/src/simulation/mod.rs
@@ -1,3 +1,4 @@
+pub mod hamiltonians;
pub mod s_5_fibration;
pub mod time_evolution;
pub mod two_level;
diff --git a/src/simulation/twoxtwo_level.rs b/src/simulation/twoxtwo_level.rs
index 8a34167..62425c8 100644
--- a/src/simulation/twoxtwo_level.rs
+++ b/src/simulation/twoxtwo_level.rs
@@ -25,11 +25,14 @@ impl State for TwoXTwoLevel {
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,
]
}