瀏覽代碼

Testing that we really are in a group

master
Pete Shadbolt 8 年之前
父節點
當前提交
82ede1f24b
共有 1 個檔案被更改,包括 13 行新增0 行删除
  1. +13
    -0
      tests/test_clifford.py

+ 13
- 0
tests/test_clifford.py 查看文件

@@ -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…
取消
儲存