Browse Source

Testing that we really are in a group

master
Pete Shadbolt 8 years ago
parent
commit
82ede1f24b
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      tests/test_clifford.py

+ 13
- 0
tests/test_clifford.py View File

@@ -59,3 +59,16 @@ def test_we_have_all_useful_gates():
assert any(x > 0 for x in results)
phase, index = [(i, r) for i, r in enumerate(results) if r>=0][0]
print "exp(1j*{}*pi/4) . {}\t=\tlc.unitaries[{}]".format(phase, name, index)


def test_group():
""" Test we are really in a group """
for a in lc.unitaries:
for b in lc.unitaries:
unitary = a*b
rotated = [exp(1j * phase * pi / 4.) * unitary for phase in range(8)]
results = [find_u(r, lc.unitaries) for r in rotated]
assert len([x for x in results if x>=0])==1




Loading…
Cancel
Save