Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
fdmalone committed Dec 12, 2024
1 parent 03ec63a commit 05203fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
20 changes: 8 additions & 12 deletions qualtran/bloqs/chemistry/pbc/first_quantization/prepare_t_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,15 @@ 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)
counts = get_cost_value(uni, QECGatesCost())
cost_dict = counts.total_t_and_ccz_count()
qual_cost = cost_dict['n_ccz']
toffolis = get_cost_value(uni, QECGatesCost()).total_toffoli_only()
qual_cost = toffolis
uni = UniformSuperpostionIJFirstQuantization(eta, num_bits_rot_aa=b_r).adjoint()
counts = get_cost_value(uni, QECGatesCost())
cost_dict = counts.total_t_and_ccz_count()
qual_cost += cost_dict['n_ccz']
toffolis = get_cost_value(uni, QECGatesCost()).total_toffoli_only()
qual_cost += toffolis
prep = PrepareTFirstQuantization(num_bits_p, eta, num_bits_rot_aa=b_r)
counts = get_cost_value(prep, QECGatesCost())
cost_dict = counts.total_t_and_ccz_count()
qual_cost += cost_dict['n_ccz']
toffolis = get_cost_value(prep, QECGatesCost()).total_toffoli_only()
qual_cost += toffolis
prep = PrepareTFirstQuantization(num_bits_p, 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']
toffolis = get_cost_value(prep, QECGatesCost()).total_toffoli_only()
qual_cost += toffolis
assert qual_cost == expected_cost
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ def test_select_t(bloq_autotester):
def test_select_kinetic_t_counts():
num_bits_p = 6
sel = SelectTFirstQuantization(num_bits_p, 10)
counts = get_cost_value(sel, QECGatesCost())
cost_dict = counts.total_t_and_ccz_count(ts_per_rotation=0)
assert cost_dict['n_ccz'] == 5 * (num_bits_p - 1) + 2
toffolis = get_cost_value(sel, QECGatesCost()).total_toffoli_only()
assert toffolis == 5 * (num_bits_p - 1) + 2

0 comments on commit 05203fe

Please sign in to comment.