From 0bbec5ce9787e0b3ba71ba0aebc79179a8591526 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Fri, 20 May 2016 18:36:25 +0100 Subject: [PATCH] Remove scipy dependency, add requirements.txt --- .gitignore | 2 ++ abp/qi.py | 14 ++++++-------- requirements.txt | 11 +++++++++++ tests/test_clifford.py | 1 - 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index d22e22f..cda0f95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +venv/ +fresh_venv/ *.npy *.cache *.pkl diff --git a/abp/qi.py b/abp/qi.py index 4749a4c..4df93b9 100644 --- a/abp/qi.py +++ b/abp/qi.py @@ -7,7 +7,6 @@ And a circuit-model simulator """ import numpy as np -from scipy.linalg import sqrtm import itertools as it def hermitian_conjugate(u): @@ -25,13 +24,12 @@ ha = hadamard = np.array([[1, 1], [1, -1]], dtype=complex) * ir2 ph = np.array([[1, 0], [0, 1j]], dtype=complex) t = np.array([[1, 0], [0, np.exp(1j*np.pi/4)]], dtype=complex) -sqy = sqrtm(1j * py) -msqy = np.array(sqrtm(-1j * py)) -sqz = np.array(sqrtm(1j * pz)) -msqz = np.array(sqrtm(-1j * pz)) -sqx = np.array(sqrtm(1j * px)) -msqx = np.array(sqrtm(-1j * px)) -paulis = (px, py, pz) +sqx = np.array([[ 1.+0.j, -0.+1.j], [-0.+1.j, 1.-0.j]], dtype=complex)*ir2 +msqx = np.array([[ 1.+0.j, 0.-1.j], [ 0.-1.j, 1.-0.j]], dtype=complex)*ir2 +sqy = np.array([[ 1.+0.j, 1.+0.j], [-1.-0.j, 1.-0.j]], dtype=complex)*ir2 +msqy = np.array([[ 1.+0.j, -1.-0.j], [ 1.+0.j, 1.-0.j]], dtype=complex)*ir2 +sqz = np.array([[ 1.+1.j, 0.+0.j], [ 0.+0.j, 1.-1.j]], dtype=complex)*ir2 +msqz = np.array([[ 1.-1.j, 0.+0.j], [ 0.+0.j, 1.+1.j]], dtype=complex)*ir2 # CZ gate cz = np.array(np.eye(4), dtype=complex) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3a52664 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,11 @@ +-e git+pete@rpi:gitpi/abp.git@68e7de7088ff268a21a7df05435120f328ad7eae#egg=abp-github/master +argparse==1.2.1 +backports.ssl-match-hostname==3.5.0.1 +decorator==4.0.9 +networkx==1.11 +numpy==1.11.0 +six==1.10.0 +tqdm==4.7.0 +websocket-client==0.37.0 +websocket-server==0.4 +wsgiref==0.1.2 diff --git a/tests/test_clifford.py b/tests/test_clifford.py index 93a5ec0..d098afd 100644 --- a/tests/test_clifford.py +++ b/tests/test_clifford.py @@ -1,5 +1,4 @@ from numpy import * -from scipy.linalg import sqrtm from tqdm import tqdm import itertools as it from abp import clifford