Skip to content

Commit

Permalink
fix call graph for Equals
Browse files Browse the repository at this point in the history
  • Loading branch information
anurudhp committed Sep 30, 2024
1 parent b14f1b4 commit 9665e17
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 9665e17

Please sign in to comment.