UnitaryGate.control

UnitaryGate.control(num_ctrl_qubits=1, label=None, ctrl_state=None)[source]

Return controlled version of gate

Parameters
  • num_ctrl_qubits (int) – number of controls to add to gate (default=1)

  • label (str) – optional gate label

  • ctrl_state (int or str or None) – The control state in decimal or as a bit string (e.g. ‘1011’). If None, use 2**num_ctrl_qubits-1.

Returns

controlled version of gate.

Return type

UnitaryGate

Raises

QiskitError – invalid ctrl_state