Skip to content

Commit

Permalink
speedup
Browse files Browse the repository at this point in the history
  • Loading branch information
anurudhp committed Nov 2, 2024
1 parent f39eff2 commit 52b7569
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions qualtran/bloqs/max_k_xor_sat/arithmetic/has_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions qualtran/bloqs/max_k_xor_sat/guiding_state_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)


Expand All @@ -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)),
Expand Down

0 comments on commit 52b7569

Please sign in to comment.