Skip to content

Commit b127bb7

Browse files
authored
Consider all-false invert_mask equal to no invert_mask (#6952)
1 parent 2933c72 commit b127bb7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cirq-core/cirq/ops/measurement_gate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def _value_equality_values_(self) -> Any:
273273
(idxs, tuple(v for _, v in np.ndenumerate(cmap)))
274274
for idxs, cmap in self._confusion_map.items()
275275
)
276-
return self.key, self.invert_mask, self._qid_shape, hashable_cmap
276+
return self.key, self.full_invert_mask(), self._qid_shape, hashable_cmap
277277

278278
def _json_dict_(self) -> Dict[str, Any]:
279279
other: Dict[str, Any] = {}

cirq-core/cirq/ops/measurement_gate_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def test_measurement_eq():
7474
eq.make_equality_group(
7575
lambda: cirq.MeasurementGate(1, 'a'),
7676
lambda: cirq.MeasurementGate(1, 'a', invert_mask=()),
77+
lambda: cirq.MeasurementGate(1, 'a', invert_mask=(False,)),
7778
lambda: cirq.MeasurementGate(1, 'a', qid_shape=(2,)),
7879
lambda: cirq.MeasurementGate(1, 'a', confusion_map={}),
7980
)
8081
eq.add_equality_group(cirq.MeasurementGate(1, 'a', invert_mask=(True,)))
81-
eq.add_equality_group(cirq.MeasurementGate(1, 'a', invert_mask=(False,)))
8282
eq.add_equality_group(
8383
cirq.MeasurementGate(1, 'a', confusion_map={(0,): np.array([[0, 1], [1, 0]])})
8484
)

0 commit comments

Comments
 (0)