Browse Source

Tidy up, delete redundant examples

master
Pete Shadbolt 8 years ago
parent
commit
4e1fd1061b
10 changed files with 0 additions and 152 deletions
  1. +0
    -13
      examples/investigate_rightphase.py
  2. +0
    -12
      examples/scale.py
  3. +0
    -16
      examples/screenshot.py
  4. +0
    -21
      examples/try_stabilizing.py
  5. +0
    -0
      examples/visualization/lattice_2d.py
  6. +0
    -0
      examples/visualization/lattice_3d.py
  7. +0
    -0
      examples/visualization/stress_test.py
  8. +0
    -23
      examples/visualization_demo.py
  9. +0
    -35
      examples/wtf.py
  10. +0
    -32
      examples/wtf2.py

+ 0
- 13
examples/investigate_rightphase.py View File

@@ -1,13 +0,0 @@
from anders_briegel import graphsim
from abp import clifford, qi
import itertools
import numpy as np

for i, j in itertools.product(range(4), range(24)):
operation, phase = clifford.conjugate(i, j)
vop_u = clifford.unitaries[i]
transform_u = clifford.unitaries[j]
u = np.dot(transform_u, np.dot(vop_u, qi.hermitian_conjugate(transform_u)))
#print u.round(2)



+ 0
- 12
examples/scale.py View File

@@ -1,12 +0,0 @@
from abp import GraphState

N = int(1e6)
g = GraphState()
g.add_nodes(xrange(N))

for i in range(N):
g.act_hadamard(i)

for i in range(N):
g.act_cz(i, (i+1) % N)


+ 0
- 16
examples/screenshot.py View File

@@ -1,16 +0,0 @@
from abp.fancy import GraphState
from abp.util import xyz
import numpy as np

N = 100
g = GraphState()
for i in range(N):
theta = 2*np.pi*i/30
pos = xyz(5*np.cos(theta), 5*np.sin(theta), i/10.)
g.add_node(i, position = pos, vop=0)

for i in range(N):
g.act_cz(i, (i+1) % N)
g.act_local_rotation(i, 12)
g.act_local_rotation(i, 10)


+ 0
- 21
examples/try_stabilizing.py View File

@@ -1,21 +0,0 @@
import abp
import numpy as np
from anders_briegel import graphsim

def wah():
N = 10
a = graphsim.GraphRegister(N)

for i in range(1000):
if np.random.random()>0.5:
j = np.random.randint(0, N-1)
a.hadamard(j)
else:
q = np.random.randint(0, N-2)
a.cphase(q, q+1)

a.print_stabilizer()


u = abp.GraphState(xrange(2))
print u.to_stabilizer()

examples/lattice_demo.py → examples/visualization/lattice_2d.py View File


examples/threedee.py → examples/visualization/lattice_3d.py View File


examples/stress_test.py → examples/visualization/stress_test.py View File


+ 0
- 23
examples/visualization_demo.py View File

@@ -1,23 +0,0 @@
from abp.viz import VisibleGraphState
import numpy as np
import time

s = VisibleGraphState()
for i in range(100):
s.add_node(i, {"position": {"x":i, "y":i, "z":i}});
s.update()
time.sleep(.5)


#for i in range(200):
#x = 10*np.cos(np.pi*2*i/60)
#y = 10*np.sin(np.pi*2*i/60)
#s.add_node(i, {"position": {"x":round(x, 2), "y":round(y, 2), "z":round(i/50., 2)}})
#s.act_local_rotation(i, "hadamard")


#for i in range(200-1):
#s.act_cz(i, i+1)
#time.sleep(.3)
#s.update()


+ 0
- 35
examples/wtf.py View File

@@ -1,35 +0,0 @@
from abp import clifford, qi, GraphState
from anders_briegel import graphsim
import numpy as np
import itertools as it


""" This is an example of where we get a discrepancy """

def pete():
a = GraphState(xrange(3))
a.act_hadamard(0)
a.act_hadamard(1)
a.act_hadamard(2)
a.act_cz(0, 1)
a.act_cz(0, 2)
a.act_local_rotation(0, 1)
a.act_local_rotation(2, 3)
a.act_cz(1,2)
return a.adj_list()

def anders():
b = graphsim.GraphRegister(3)
b.hadamard(0)
b.hadamard(1)
b.hadamard(2)
b.cphase(0, 1)
b.cphase(0, 2)
b.local_op(0, graphsim.LocCliffOp(1))
b.local_op(2, graphsim.LocCliffOp(3))
b.cphase(1,2)
b.print_adj_list()

pete()
anders()


+ 0
- 32
examples/wtf2.py View File

@@ -1,32 +0,0 @@
from abp import GraphState
from anders_briegel import graphsim
from abp import clifford
import random, difflib, re
from copy import deepcopy


def isequal(a, b):
""" TODO: Sketchy as you like. Remove this abomination """
aa = a.get_adj_list()
bb = b.adj_list()
return re.sub("\\s", "", aa) == re.sub("\\s", "", bb)

clifford.use_old_cz()

N = 3

a = graphsim.GraphRegister(N)
b = GraphState(range(N))
previous_state, previous_cz = None, None
while isequal(a, b):
if random.random()>0.5:
j = random.randint(0, N-1)
a.hadamard(j)
b.act_hadamard(j)
else:
q = random.randint(0, N-2)
if a!=b:
a.cphase(q, q+1)
b.act_cz(q, q+1)



Loading…
Cancel
Save