summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2019-11-30 13:43:57 +0100
committerDennis Kobert <dennis@kobert.dev>2019-11-30 13:43:57 +0100
commit84b9f0eb682b60ecc8592bef22c549051d200ead (patch)
tree17de6974b020081b0c17886e747d84e9ff73b975
parentb3c6bad7b98c156429c88e1ecad4ffb53db2871b (diff)
Add commadline options
-rw-r--r--single_dequantify.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/single_dequantify.py b/single_dequantify.py
index 8e801a1..96f76ed 100644
--- a/single_dequantify.py
+++ b/single_dequantify.py
@@ -1,20 +1,23 @@
-#import plotting
+import sys
import subprocess
import math as mth
import cmath as cmt
import numpy as npy
import scipy.linalg as sla
-alpha = 3
+alpha = 1
beta = 1
-
-norm = npy.linalg.norm([alpha, beta])
-state = npy.array([alpha / norm, beta / norm])
-
dt = 0.1
iterations = 61
-H = npy.array([[2,0],[0,3]])
+H = npy.array([[1,0],[0,2]])
+
+if len(sys.argv) == 3:
+ alpha = complex(sys.argv[1])
+ beta = complex(sys.argv[2])
+
+norm = npy.linalg.norm([alpha, beta])
+state = npy.array([alpha / norm, beta / norm])
def time_evolution(state, dt = dt):
return npy.dot(state, sla.expm(-1j * dt * H))