We fail when running against Anders and Briegel simply because we use a different CZ tablemaster
@@ -153,7 +153,7 @@ except IOError: | |||||
conjugation_table = get_conjugation_table(unitaries) | conjugation_table = get_conjugation_table(unitaries) | ||||
times_table = get_times_table(unitaries) | times_table = get_times_table(unitaries) | ||||
cz_table = get_cz_table(unitaries) | cz_table = get_cz_table(unitaries) | ||||
cz_table = get_ab_cz_table() | |||||
#cz_table = get_ab_cz_table() | |||||
# Write it all to disk | # Write it all to disk | ||||
np.save("unitaries.npy", unitaries) | np.save("unitaries.npy", unitaries) | ||||
@@ -3,12 +3,13 @@ from abp.qi import CircuitModel | |||||
from abp import clifford | from abp import clifford | ||||
import numpy as np | import numpy as np | ||||
import random | import random | ||||
from tqdm import tqdm | |||||
REPEATS = 10 | |||||
REPEATS = 100 | |||||
def test_single_qubit(n=1): | def test_single_qubit(n=1): | ||||
""" A multi qubit test with Hadamards only""" | """ A multi qubit test with Hadamards only""" | ||||
for repeat in range(REPEATS): | |||||
for repeat in tqdm(range(REPEATS), desc="Testing against circuit model") : | |||||
g = GraphState([0]) | g = GraphState([0]) | ||||
c = CircuitModel(1) | c = CircuitModel(1) | ||||
@@ -22,7 +23,7 @@ def test_single_qubit(n=1): | |||||
def test_hadamard_only_multiqubit(n=6): | def test_hadamard_only_multiqubit(n=6): | ||||
""" A multi qubit test with Hadamards only""" | """ A multi qubit test with Hadamards only""" | ||||
for qqq in range(REPEATS): | |||||
for repeat in tqdm(range(REPEATS), desc="Testing against circuit model") : | |||||
g = GraphState(range(n)) | g = GraphState(range(n)) | ||||
c = CircuitModel(n) | c = CircuitModel(n) | ||||
@@ -53,7 +54,7 @@ def test_all_multiqubit(n=4): | |||||
assert g.to_state_vector() == c | assert g.to_state_vector() == c | ||||
for i in range(100): | |||||
for repeat in tqdm(range(REPEATS), desc="Testing against circuit model") : | |||||
a, b = np.random.randint(0, n-1, 2) | a, b = np.random.randint(0, n-1, 2) | ||||
if a != b: | if a != b: | ||||
g.act_cz(a, b) | g.act_cz(a, b) | ||||
@@ -67,14 +67,6 @@ def test_times_table(): | |||||
assert clifford.times_table[0][4] == 4 | assert clifford.times_table[0][4] == 4 | ||||
def _test_cz_table_is_symmetric(): | |||||
""" Test the CZ table is symmetric """ | |||||
for bond, (a, b) in it.product([0, 1], it.combinations(xrange(24), 2)): | |||||
_, a1, a2 = clifford.cz_table[bond, a, b] | |||||
_, b1, b2 = clifford.cz_table[bond, b, a] | |||||
assert (a1, a2) == (b2, b1) | |||||
def test_cz_table_makes_sense(): | def test_cz_table_makes_sense(): | ||||
""" Test the CZ table is symmetric """ | """ Test the CZ table is symmetric """ | ||||
hadamard = clifford.by_name["hadamard"] | hadamard = clifford.by_name["hadamard"] | ||||
@@ -39,12 +39,3 @@ def test_cz_table(): | |||||
assert np.allclose(computed_output, table_output) | assert np.allclose(computed_output, table_output) | ||||
def _test_match(): | |||||
""" Tests that they actually match """ | |||||
ab_cz_table = get_ab_cz_table() | |||||
rows = it.product([0, 1], it.combinations_with_replacement(range(24), 2)) | |||||
for bond, (c1, c2) in rows: | |||||
assert np.all(ab_cz_table == clifford.cz_table) | |||||