浏览代码

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




正在加载...
取消
保存