From 05203fe7210a0e1a58e3a4fac6f7edc2d7731212 Mon Sep 17 00:00:00 2001 From: Fionn Malone Date: Thu, 12 Dec 2024 09:16:29 -0800 Subject: [PATCH] Simplify --- .../pbc/first_quantization/prepare_t_test.py | 20 ++++++++----------- .../pbc/first_quantization/select_t_test.py | 5 ++--- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/qualtran/bloqs/chemistry/pbc/first_quantization/prepare_t_test.py b/qualtran/bloqs/chemistry/pbc/first_quantization/prepare_t_test.py index abdb7d98c..026f232dd 100644 --- a/qualtran/bloqs/chemistry/pbc/first_quantization/prepare_t_test.py +++ b/qualtran/bloqs/chemistry/pbc/first_quantization/prepare_t_test.py @@ -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 diff --git a/qualtran/bloqs/chemistry/pbc/first_quantization/select_t_test.py b/qualtran/bloqs/chemistry/pbc/first_quantization/select_t_test.py index 4c8e668bb..58dec6f7e 100644 --- a/qualtran/bloqs/chemistry/pbc/first_quantization/select_t_test.py +++ b/qualtran/bloqs/chemistry/pbc/first_quantization/select_t_test.py @@ -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