Browse Source

Remove scipy dependency, add requirements.txt

master
Pete Shadbolt 8 years ago
parent
commit
0bbec5ce97
4 changed files with 19 additions and 9 deletions
  1. +2
    -0
      .gitignore
  2. +6
    -8
      abp/qi.py
  3. +11
    -0
      requirements.txt
  4. +0
    -1
      tests/test_clifford.py

+ 2
- 0
.gitignore View File

@@ -1,3 +1,5 @@
venv/
fresh_venv/
*.npy *.npy
*.cache *.cache
*.pkl *.pkl


+ 6
- 8
abp/qi.py View File

@@ -7,7 +7,6 @@ And a circuit-model simulator
""" """


import numpy as np import numpy as np
from scipy.linalg import sqrtm
import itertools as it import itertools as it


def hermitian_conjugate(u): 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) ph = np.array([[1, 0], [0, 1j]], dtype=complex)
t = np.array([[1, 0], [0, np.exp(1j*np.pi/4)]], 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 gate
cz = np.array(np.eye(4), dtype=complex) cz = np.array(np.eye(4), dtype=complex)


+ 11
- 0
requirements.txt View File

@@ -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

+ 0
- 1
tests/test_clifford.py View File

@@ -1,5 +1,4 @@
from numpy import * from numpy import *
from scipy.linalg import sqrtm
from tqdm import tqdm from tqdm import tqdm
import itertools as it import itertools as it
from abp import clifford from abp import clifford


Loading…
Cancel
Save