Skip to content

Commit

Permalink
fix call graph for Equals (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
anurudhp authored Sep 30, 2024
1 parent 70dd9f5 commit 542ffc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 1 addition & 6 deletions qualtran/bloqs/arithmetic/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,12 +1008,7 @@ def build_call_graph(self, ssa: 'SympySymbolAllocator') -> 'BloqCountDictT':
cvs = [0] * self.bitsize
else:
cvs = HasLength(self.bitsize)
return {
Xor(self.dtype): 2,
MultiControlX(cvs=cvs): 1,
MultiAnd(cvs=cvs).adjoint(): 1,
CNOT(): 1,
}
return {Xor(self.dtype): 2, MultiControlX(cvs=cvs): 1}

def on_classical_vals(self, x: int, y: int, target: int) -> Dict[str, 'ClassicalValT']:
return {'x': x, 'y': y, 'target': target ^ (x == y)}
Expand Down
6 changes: 6 additions & 0 deletions qualtran/bloqs/arithmetic/comparison_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ def test_classical_equals(dtype):
)


def test_equals_call_graph():
bloq = Equals(QUInt(4))

qlt_testing.assert_equivalent_bloq_counts(bloq, ignore_split_join)


def test_equals_a_constant():
bb = BloqBuilder()
bitsize = 5
Expand Down

0 comments on commit 542ffc5

Please sign in to comment.