Selaa lähdekoodia

We need to emulate LocCliffOp.conjugate() -- WIP

master
Pete Shadbolt 8 vuotta sitten
vanhempi
commit
68e7de7088
4 muutettua tiedostoa jossa 56 lisäystä ja 0 poistoa
  1. +12
    -0
      examples/scale.py
  2. +16
    -0
      examples/screenshot.py
  3. +13
    -0
      scripts/investigate_rightphase.py
  4. +15
    -0
      tests/test_conjugation.py

+ 12
- 0
examples/scale.py Näytä tiedosto

@@ -0,0 +1,12 @@
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)


+ 16
- 0
examples/screenshot.py Näytä tiedosto

@@ -0,0 +1,16 @@
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)


+ 13
- 0
scripts/investigate_rightphase.py Näytä tiedosto

@@ -0,0 +1,13 @@
from anders_briegel import graphsim

for i in range(4):
for j in range(24):
a = graphsim.LocCliffOp(i)
b = graphsim.LocCliffOp(j)
print
print i, j
print i, j, a.op, b.op
output = a.conjugate(b)
print i, j, a.op, b.op, output.ph



+ 15
- 0
tests/test_conjugation.py Näytä tiedosto

@@ -0,0 +1,15 @@
from anders_briegel import graphsim
import itertools

#//! replaces op by trans * op * trans^dagger and returns a phase,
#/*! either +1 or -1 (as RightPhase(0) or RightPhase(2)) */
#RightPhase conjugate (const LocCliffOp trans);

def test_conjugation():
""" Test that clifford.conugate() agrees with graphsim.LocCliffOp.conjugate """
for i, j in it.product(range(4), range(24)):
a = graphsim.LocCliffOp(i)
b = graphsim.LocCliffOp(j)
output = a.conjugate(b)
print i, j, a.op, b.op, output.ph


Loading…
Peruuta
Tallenna