Skip to content

Commit 542ffc5

Browse files
authored
fix call graph for Equals (#1429)
1 parent 70dd9f5 commit 542ffc5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

qualtran/bloqs/arithmetic/comparison.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,12 +1008,7 @@ def build_call_graph(self, ssa: 'SympySymbolAllocator') -> 'BloqCountDictT':
10081008
cvs = [0] * self.bitsize
10091009
else:
10101010
cvs = HasLength(self.bitsize)
1011-
return {
1012-
Xor(self.dtype): 2,
1013-
MultiControlX(cvs=cvs): 1,
1014-
MultiAnd(cvs=cvs).adjoint(): 1,
1015-
CNOT(): 1,
1016-
}
1011+
return {Xor(self.dtype): 2, MultiControlX(cvs=cvs): 1}
10171012

10181013
def on_classical_vals(self, x: int, y: int, target: int) -> Dict[str, 'ClassicalValT']:
10191014
return {'x': x, 'y': y, 'target': target ^ (x == y)}

qualtran/bloqs/arithmetic/comparison_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ def test_classical_equals(dtype):
310310
)
311311

312312

313+
def test_equals_call_graph():
314+
bloq = Equals(QUInt(4))
315+
316+
qlt_testing.assert_equivalent_bloq_counts(bloq, ignore_split_join)
317+
318+
313319
def test_equals_a_constant():
314320
bb = BloqBuilder()
315321
bitsize = 5

0 commit comments

Comments
 (0)