| @@ -0,0 +1 @@ | |||||
| recursive-include abp/static * | |||||
| @@ -1,20 +0,0 @@ | |||||
| from abp.fancy import GraphState | |||||
| from abp.util import xyz | |||||
| from abp.clifford import * | |||||
| psi = GraphState() | |||||
| psi.add_node(0, position = xyz(0, 0)) | |||||
| psi.add_node(1, position = xyz(1, 1)) | |||||
| psi.add_node(2, position = xyz(3, 2)) | |||||
| psi.add_node(3, position = xyz(0, 3)) | |||||
| for n in psi.node: | |||||
| psi.act_hadamard(n) | |||||
| psi.act_cz(0, 1) | |||||
| psi.act_cz(0, 3) | |||||
| psi.act_cz(1, 3) | |||||
| psi.act_cz(1, 2) | |||||
| while True: | |||||
| psi.update() | |||||
| psi.local_complementation(1) | |||||
| @@ -1,6 +1,9 @@ | |||||
| from abp.fancy import GraphState | from abp.fancy import GraphState | ||||
| from abp.util import xyz | |||||
| import networkx as nx | |||||
| g = GraphState() | |||||
| n = 100 | |||||
| g.add_nodes_from(range(n)) | |||||
| n = 10 | |||||
| g = GraphState(range(n)) | |||||
| nx.set_node_attributes(g, "color", "red") | |||||
| g.add_edges_from([i, i+1] for i in range(n-1)) | g.add_edges_from([i, i+1] for i in range(n-1)) | ||||
| print g.node[0]["color"] | |||||
| @@ -0,0 +1,8 @@ | |||||
| #!/bin/bash | |||||
| rm -r abp.egg-info | |||||
| rm -r build | |||||
| rm -r dist | |||||
| python setup.py build sdist | |||||
| tar -tvf dist/abp-0.4.5.tar.gz | |||||
| @@ -0,0 +1,8 @@ | |||||
| #!/bin/bash | |||||
| rm -r abp.egg-info | |||||
| rm -r build | |||||
| rm -r dist | |||||
| python setup.py build sdist | |||||
| tar -tvf dist/abp-0.4.5.tar.gz | |||||
| @@ -1,13 +1,14 @@ | |||||
| from setuptools import setup, find_packages | |||||
| from setuptools import setup | |||||
| from glob import glob | from glob import glob | ||||
| from os import path | from os import path | ||||
| STATIC = glob("static/*.*")+glob("static/img/*.*")+glob("static/scripts/*.*") | |||||
| STATIC = glob("abp/static/*.*")+glob("abp/static/img/*.*")+glob("abp/static/scripts/*.*") | |||||
| print STATIC | |||||
| setup( | setup( | ||||
| name = "abp", | name = "abp", | ||||
| version = "0.4.3", | |||||
| packages = find_packages(), | |||||
| version = "0.4.6", | |||||
| packages = ["abp", "abp.static"], | |||||
| test_suite = "tests", | test_suite = "tests", | ||||
| author = "Pete Shadbolt", | author = "Pete Shadbolt", | ||||
| author_email = "hello@peteshadbolt.co.uk", | author_email = "hello@peteshadbolt.co.uk", | ||||
| @@ -17,5 +18,6 @@ setup( | |||||
| setup_requires = ["numpy"], | setup_requires = ["numpy"], | ||||
| scripts = ["bin/abpserver"], | scripts = ["bin/abpserver"], | ||||
| install_requires = ["numpy", "networkx", "tqdm", "websocket-client", "websocket-server"], | install_requires = ["numpy", "networkx", "tqdm", "websocket-client", "websocket-server"], | ||||
| package_data = {"abp.static": STATIC} | |||||
| package_data = {"abp.static": STATIC}, | |||||
| include_package_data=True | |||||
| ) | ) | ||||
| @@ -1 +0,0 @@ | |||||
| graph9.g6 | |||||
| @@ -1,2 +0,0 @@ | |||||
| A? | |||||
| A_ | |||||
| @@ -1,4 +0,0 @@ | |||||
| B? | |||||
| BO | |||||
| BW | |||||
| Bw | |||||
| @@ -1,11 +0,0 @@ | |||||
| C? | |||||
| CC | |||||
| CE | |||||
| CF | |||||
| CQ | |||||
| CT | |||||
| CU | |||||
| CV | |||||
| C] | |||||
| C^ | |||||
| C~ | |||||
| @@ -1,34 +0,0 @@ | |||||
| D?? | |||||
| D?_ | |||||
| D?o | |||||
| D?w | |||||
| D?{ | |||||
| DCO | |||||
| DCW | |||||
| DCc | |||||
| DCo | |||||
| DCs | |||||
| DCw | |||||
| DC{ | |||||
| DEk | |||||
| DEo | |||||
| DEs | |||||
| DEw | |||||
| DE{ | |||||
| DFw | |||||
| DF{ | |||||
| DQg | |||||
| DQo | |||||
| DQw | |||||
| DQ{ | |||||
| DTk | |||||
| DTw | |||||
| DT{ | |||||
| DUW | |||||
| DUw | |||||
| DU{ | |||||
| DV{ | |||||
| D]w | |||||
| D]{ | |||||
| D^{ | |||||
| D~{ | |||||
| @@ -1,67 +0,0 @@ | |||||
| from abp import GraphState, clifford | |||||
| from anders_briegel import graphsim | |||||
| import numpy as np | |||||
| from tqdm import tqdm | |||||
| import dummy | |||||
| import itertools as it | |||||
| from config import * | |||||
| N = 10 | |||||
| m = {1: graphsim.lco_X, 2: graphsim.lco_Y, 3: graphsim.lco_Z} | |||||
| def test_2qubit(): | |||||
| """ Relentless testing of measurements """ | |||||
| clifford.use_old_cz() | |||||
| for measurement in (3, 2, 1): | |||||
| for outcome in (0, 1): | |||||
| a, b = dummy.bell() | |||||
| a.measure(0, str(measurement), outcome) | |||||
| b.measure(0, m[measurement], None, outcome) | |||||
| assert a == b, (measurement, outcome) | |||||
| def test_multiqubit(): | |||||
| """ Relentless testing of measurements """ | |||||
| for measurement in (3,2,1,): | |||||
| for i in tqdm(range(REPEATS), "Testing measurement {}".format(measurement)): | |||||
| for outcome in (0, 1): | |||||
| a, b = dummy.clean_random_state(N) | |||||
| a.measure(0, str(measurement), outcome) | |||||
| b.measure(0, m[measurement], None, outcome) | |||||
| assert a == b, (measurement, outcome) | |||||
| def test_multiqubit2(): | |||||
| """ Relentless testing of measurements """ | |||||
| for measurement in (3,2,1): | |||||
| for i in tqdm(range(REPEATS), "Testing {} measurement".format(measurement)): | |||||
| for outcome in (0, 1): | |||||
| for rotation in range(24): | |||||
| a, b = dummy.clean_random_state(N) | |||||
| assert a == b | |||||
| a.act_local_rotation(0, str(rotation)) | |||||
| b.local_op(0, graphsim.LocCliffOp(rotation)) | |||||
| #print "{} ------------------".format(rotation) | |||||
| #print "pjs b4:", a.to_json() | |||||
| #print "a&b b4:", b.to_json() | |||||
| oa = a.measure(0, str(measurement), outcome) | |||||
| ob = b.measure(0, m[measurement], None, outcome) | |||||
| assert oa == ob, (oa, ob, rotation) | |||||
| #print "pjs af:", a.to_json() | |||||
| #print "a&b af:", b.to_json() | |||||
| assert a == b, (measurement, outcome, rotation) | |||||
| def test_multiqubit3(): | |||||
| """ More measurement """ | |||||
| for i in tqdm(range(REPEATS), "Testing messy measurement"): | |||||
| for measurement, outcome in it.product((3,2,1), (0,1)): | |||||
| a, b = dummy.messy_random_state(N) | |||||
| assert a == b | |||||
| oa = a.measure(0, str(measurement), outcome) | |||||
| ob = b.measure(0, m[measurement], None, outcome) | |||||
| assert oa == ob, (oa, ob, rotation) | |||||
| assert a == b, (measurement, outcome) | |||||
| @@ -1,23 +0,0 @@ | |||||
| from abp import GraphState, clifford | |||||
| from anders_briegel import graphsim | |||||
| import numpy as np | |||||
| from tqdm import tqdm | |||||
| import itertools as it | |||||
| import dummy | |||||
| from config import * | |||||
| N = 10 | |||||
| m = {1: graphsim.lco_X, 2: graphsim.lco_Y, 3: graphsim.lco_Z} | |||||
| def test_1(): | |||||
| """ Check that single qubits work """ | |||||
| space = it.product(range(24), (3,2,1), (0,1)) | |||||
| for rotation, measurement, outcome in tqdm(space, "Testing single qubit measurements"): | |||||
| #print "\nr{} m{} o{}".format(rotation, measurement, outcome) | |||||
| a, b = dummy.onequbit() | |||||
| #print a.to_json()["node"][0]["vop"], b.to_json()["node"][0]["vop"] | |||||
| a.measure(0, str(measurement), outcome) | |||||
| b.measure(0, m[measurement], None, outcome) | |||||
| #print a.to_json()["node"][0]["vop"], b.to_json()["node"][0]["vop"] | |||||
| assert a == b, (a.to_json()["node"][0], b.to_json()["node"][0]) | |||||