![]() |
A multiqubit classical control condition with a bitmask.
Inherits From: Condition
cirq.BitMaskKeyCondition(
key,
index=attr_dict['index'].default,
target_value=attr_dict['target_value'].default,
equal_target=attr_dict['equal_target'].default,
bitmask=attr_dict['bitmask'].default
)
Used in the notebooks
Used in the tutorials |
---|
The control is based on a single measurement key and allows comparing equality or inequality after taking the bitwise and with a bitmask.
Examples | |
---|---|
|
The bits in the bitmask have the same order as the qubits passed to cirq.measure(...)
. That's
the most significant bit corresponds to the the first (left most) qubit.
Methods
create_equal_mask
@staticmethod
create_equal_mask( key: 'cirq.MeasurementKey', bitmask: int, *, index: int = -1 ) -> 'BitMaskKeyCondition'
Creates a condition that evaluates (meas & bitmask) == bitmask.
create_not_equal_mask
@staticmethod
create_not_equal_mask( key: 'cirq.MeasurementKey', bitmask: int, *, index: int = -1 ) -> 'BitMaskKeyCondition'
Creates a condition that evaluates (meas & bitmask) != bitmask.
replace_key
replace_key(
current: 'cirq.MeasurementKey', replacement: 'cirq.MeasurementKey'
)
Replaces the control keys.
resolve
resolve(
classical_data: 'cirq.ClassicalDataStoreReader'
) -> bool
Resolves the condition based on the measurements.
__eq__
__eq__(
other
)
Method generated by attrs for class BitMaskKeyCondition.
__ne__
__ne__(
other
)
Check equality and either forward a NotImplemented or return the result negated.