CXPowGate.controlled(num_controls: int = None, control_values: Optional[Sequence[Union[int, Collection[int]]]] = None, control_qid_shape: Optional[Tuple[int, ]] = None) → cirq.ops.raw_types.Gate[source]

Returns a controlled CXPowGate, using a CCXPowGate where possible.

The controlled method of the Gate class, of which this class is a
child, returns a ControlledGate. This method overrides this behavior
to return a CCXPowGate or a ControlledGate of a CCXPowGate, when
this is possible.
The conditions for the override to occur are:
* The global_shift of the CXPowGate is 0.
* The control_values and control_qid_shape are compatible with
the CCXPowGate:
* The last value of control_qid_shape is a qubit.
* The last value of control_values corresponds to the
control being satisfied if that last qubit is 1 and
not satisfied if the last qubit is 0.
If these conditions are met, then the returned object is a CCXPowGate
or, in the case that there is more than one controlled qudit, a
ControlledGate with the Gate being a CCXPowGate. In the
latter case the ControlledGate is controlled by one less qudit
than specified in control_values and control_qid_shape (since
one of these, the last qubit, is used as the control for the
If the above conditions are not met, a ControlledGate of this
gate will be returned.