소스 검색

Fixed `GraphState.measure_y`

Had a dumb translation error
master
Pete Shadbolt 8 년 전
부모
커밋
c6384448e3
2개의 변경된 파일11개의 추가작업 그리고 9개의 파일을 삭제
  1. +1
    -1
      abp/graphstate.py
  2. +10
    -8
      tests/test_measurement_against_anders_and_briegel.py

+ 1
- 1
abp/graphstate.py 파일 보기

@@ -196,7 +196,7 @@ class GraphState(object):
for i, j in it.combinations(vngbh, 2):
self.toggle_edge(i, j)

self.act_local_rotation(node, "msqz" if result else "msqz_h")
self.act_local_rotation(node, "sqz" if result else "msqz")
return result

def measure_z(self, node, result):


+ 10
- 8
tests/test_measurement_against_anders_and_briegel.py 파일 보기

@@ -6,7 +6,7 @@ import dummy

N = 2
REPEATS = 10
PZ = graphsim.lco_Z
m = {1: graphsim.lco_X, 2: graphsim.lco_Y, 3: graphsim.lco_Z}

def _test_multiqubit_measurement_pz():
""" Test a multiqubit measurement """
@@ -22,10 +22,12 @@ def _test_multiqubit_measurement_pz():


def test_multiqubit_pz():
for i in range(10):
a, b = dummy.bell()
assert a == b
print a.measure(0, "pz", 1)
print b.measure(0, PZ, None, 1)
assert a == b
for measurement in (3, 2,):
for outcome in (0, 1):
a, b = dummy.bell()
a.measure(0, str(measurement), outcome)
b.measure(0, m[measurement], None, outcome)
print a.to_json()
print b.to_json()
assert a == b, (measurement, outcome)

불러오는 중...
취소
저장