Selaa lähdekoodia

Pratting with MANIFEST

master
Pete Shadbolt 8 vuotta sitten
vanhempi
commit
6107946244
13 muutettua tiedostoa jossa 30 lisäystä ja 170 poistoa
  1. +1
    -0
      MANIFEST.in
  2. +0
    -20
      examples/local_complementation.py
  3. +6
    -3
      examples/mix_graph_and_networkx.py
  4. +8
    -0
      remake.sh
  5. +8
    -0
      run.sh
  6. +7
    -5
      setup.py
  7. +0
    -1
      tests/graphs/.gitignore
  8. +0
    -2
      tests/graphs/graph2.g6
  9. +0
    -4
      tests/graphs/graph3.g6
  10. +0
    -11
      tests/graphs/graph4.g6
  11. +0
    -34
      tests/graphs/graph5.g6
  12. +0
    -67
      tests/old/test_measurement_against_anders_and_briegel.py
  13. +0
    -23
      tests/old/test_single_qubit_measurement_against_anb.py

+ 1
- 0
MANIFEST.in Näytä tiedosto

@@ -0,0 +1 @@
recursive-include abp/static *

+ 0
- 20
examples/local_complementation.py Näytä tiedosto

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

+ 6
- 3
examples/mix_graph_and_networkx.py Näytä tiedosto

@@ -1,6 +1,9 @@
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))
print g.node[0]["color"]

+ 8
- 0
remake.sh Näytä tiedosto

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

+ 8
- 0
run.sh Näytä tiedosto

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

+ 7
- 5
setup.py Näytä tiedosto

@@ -1,13 +1,14 @@
from setuptools import setup, find_packages
from setuptools import setup
from glob import glob
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(
name = "abp",
version = "0.4.3",
packages = find_packages(),
version = "0.4.6",
packages = ["abp", "abp.static"],
test_suite = "tests",
author = "Pete Shadbolt",
author_email = "hello@peteshadbolt.co.uk",
@@ -17,5 +18,6 @@ setup(
setup_requires = ["numpy"],
scripts = ["bin/abpserver"],
install_requires = ["numpy", "networkx", "tqdm", "websocket-client", "websocket-server"],
package_data = {"abp.static": STATIC}
package_data = {"abp.static": STATIC},
include_package_data=True
)

+ 0
- 1
tests/graphs/.gitignore Näytä tiedosto

@@ -1 +0,0 @@
graph9.g6

+ 0
- 2
tests/graphs/graph2.g6 Näytä tiedosto

@@ -1,2 +0,0 @@
A?
A_

+ 0
- 4
tests/graphs/graph3.g6 Näytä tiedosto

@@ -1,4 +0,0 @@
B?
BO
BW
Bw

+ 0
- 11
tests/graphs/graph4.g6 Näytä tiedosto

@@ -1,11 +0,0 @@
C?
CC
CE
CF
CQ
CT
CU
CV
C]
C^
C~

+ 0
- 34
tests/graphs/graph5.g6 Näytä tiedosto

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

+ 0
- 67
tests/old/test_measurement_against_anders_and_briegel.py Näytä tiedosto

@@ -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)
#print

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)


+ 0
- 23
tests/old/test_single_qubit_measurement_against_anb.py Näytä tiedosto

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

Loading…
Peruuta
Tallenna