| @@ -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) | |||||
| @@ -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) | |||||
| @@ -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 i, j | |||||
| print i, j, a.op, b.op | |||||
| output = a.conjugate(b) | |||||
| print i, j, a.op, b.op, output.ph | |||||
| @@ -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 | |||||