diff --git a/qualtran/bloqs/max_k_xor_sat/arithmetic/has_duplicates.py b/qualtran/bloqs/max_k_xor_sat/arithmetic/has_duplicates.py index 9e576db23..00a54b23e 100644 --- a/qualtran/bloqs/max_k_xor_sat/arithmetic/has_duplicates.py +++ b/qualtran/bloqs/max_k_xor_sat/arithmetic/has_duplicates.py @@ -15,8 +15,8 @@ from attrs import frozen -from qualtran import Bloq, BloqDocSpec, QAny, QBit, QDType, Signature -from qualtran.bloqs.arithmetic import LessThanEqual +from qualtran import Bloq, BloqDocSpec, QAny, QBit, QDType, Signature, QUInt +from qualtran.bloqs.arithmetic import LinearDepthHalfLessThanEqual from qualtran.bloqs.mcmt import MultiControlX from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator from qualtran.symbolics import HasLength, SymbolicInt @@ -59,9 +59,11 @@ def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: counts = Counter[Bloq]() - counts[LessThanEqual(logn, logn)] += self.l - 1 + leq = LinearDepthHalfLessThanEqual(QUInt(logn)) + + counts[leq] += self.l - 1 counts[MultiControlX(cvs=HasLength(self.l - 1))] += 1 - counts[LessThanEqual(logn, logn).adjoint()] += self.l - 1 + counts[leq.adjoint()] += self.l - 1 return counts diff --git a/qualtran/bloqs/max_k_xor_sat/guiding_state_test.py b/qualtran/bloqs/max_k_xor_sat/guiding_state_test.py index 2b9e3cff7..aa354f429 100644 --- a/qualtran/bloqs/max_k_xor_sat/guiding_state_test.py +++ b/qualtran/bloqs/max_k_xor_sat/guiding_state_test.py @@ -78,7 +78,7 @@ def test_t_cost(): B_GRAD = bloq.simple_guiding_state.phasegrad_bitsize assert gc == GateCounts( - and_bloq=364, toffoli=6 * (B_GRAD - 2), cswap=192, clifford=ANY, measurement=ANY + and_bloq=352, toffoli=6 * (B_GRAD - 2), cswap=192, clifford=ANY, measurement=ANY ) @@ -104,7 +104,7 @@ def test_t_cost_symb_c(bloq_ex): + l * logl + l + c * (4 * m + (2 * m + 1) * (klogn_roundtrip - 1) - 4) - + (2 * l - 2) * (2 * logn + 1) + + (l - 1) * logn - 2 ), toffoli=c * (2 * (B_GRAD - 2)),