Skip to main contentIBM Quantum Documentation Mirror

MCXGrayCode

class qiskit.circuit.library.MCXGrayCode(num_ctrl_qubits=None, label=None, ctrl_state=None, *, _base_label=None)

GitHub

Bases: MCXGate

Implement the multi-controlled X gate using the Gray code.

This delegates the implementation to the MCU1 gate, since X=HU1(π)HX = H \cdot U1(\pi) \cdot H.

Create new MCX gate.


Methods

Parameters

  • num_ctrl_qubits (Optional[int]) –
  • label (Optional[str]) –
  • ctrl_state (Optional[Union[str, int]]) –

inverse

inverse(annotated=False)

GitHub

Invert this gate. The MCX is its own inverse.

Parameters

annotated (bool) – when set to True, this is typically used to return an AnnotatedOperation with an inverse modifier set instead of a concrete Gate. However, for this class this argument is ignored as this gate is self-inverse.

Returns

inverse gate (self-inverse).

Return type

MCXGrayCode