Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
fdmalone committed Dec 12, 2024
1 parent 05203fe commit 6a3c9bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ def test_prepare_kinetic_t_counts():
n_eta = (eta - 1).bit_length()
expected_cost = (14 * n_eta + 8 * b_r - 36) + 2 * (2 * num_bits_p + 9)
uni = UniformSuperpostionIJFirstQuantization(eta, num_bits_rot_aa=b_r)
toffolis = get_cost_value(uni, QECGatesCost()).total_toffoli_only()
qual_cost = toffolis

qual_cost = get_cost_value(uni, QECGatesCost()).total_toffoli_only()
uni = UniformSuperpostionIJFirstQuantization(eta, num_bits_rot_aa=b_r).adjoint()
toffolis = get_cost_value(uni, QECGatesCost()).total_toffoli_only()
qual_cost += toffolis
qual_cost += get_cost_value(uni, QECGatesCost()).total_toffoli_only()
prep = PrepareTFirstQuantization(num_bits_p, eta, num_bits_rot_aa=b_r)
toffolis = get_cost_value(prep, QECGatesCost()).total_toffoli_only()
qual_cost += toffolis
qual_cost += get_cost_value(prep, QECGatesCost()).total_toffoli_only()
prep = PrepareTFirstQuantization(num_bits_p, eta, num_bits_rot_aa=b_r).adjoint()
toffolis = get_cost_value(prep, QECGatesCost()).total_toffoli_only()
qual_cost += toffolis
qual_cost += get_cost_value(prep, QECGatesCost()).total_toffoli_only()
assert qual_cost == expected_cost
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,11 @@ def test_prepare_kinetic_t_proj_counts():
expected_cost = 2 * (2 * num_bits_n + 9) + 2 * (num_bits_n - num_bits_p) + 20
qual_cost = 0
prep = PrepareTFirstQuantizationWithProj(num_bits_p, num_bits_n, eta, num_bits_rot_aa=b_r)
_, counts = prep.call_graph()
counts = get_cost_value(prep, QECGatesCost())
cost_dict = counts.total_t_and_ccz_count()
qual_cost += cost_dict['n_ccz']
qual_cost += get_cost_value(prep, QECGatesCost()).total_toffoli_only()
prep = PrepareTFirstQuantizationWithProj(
num_bits_p, num_bits_n, eta, num_bits_rot_aa=b_r
).adjoint()
counts = get_cost_value(prep, QECGatesCost())
cost_dict = counts.total_t_and_ccz_count()
qual_cost += cost_dict['n_ccz']
qual_cost += get_cost_value(prep, QECGatesCost()).total_toffoli_only()
assert qual_cost == expected_cost


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ def test_sel_t_proj(bloq_autotester):
def test_select_kinetic_t_counts():
num_bits_n = 6
sel = SelectTFirstQuantizationWithProj(num_bits_n, 10)
counts = get_cost_value(sel, QECGatesCost())
cost_dict = counts.total_t_and_ccz_count()
assert cost_dict['n_ccz'] == 5 * (num_bits_n - 1) + 2 + 1
toffolis = get_cost_value(sel, QECGatesCost()).total_toffoli_only()
assert toffolis == 5 * (num_bits_n - 1) + 2 + 1

0 comments on commit 6a3c9bf

Please sign in to comment.