MCXRecursive
class qiskit.circuit.library.MCXRecursive(num_ctrl_qubits=None, label=None, ctrl_state=None, *, _base_label=None)
Bases: MCXGate
Implement the multi-controlled X gate using recursion.
Using a single clean ancilla qubit, the multi-controlled X gate is split into four sub-registers, each one of them uses the V-chain method.
The method is based on Lemma 9 of [2], first shown in Lemma 7.3 of [1].
References
- Barenco et al., 1995. https://arxiv.org/pdf/quant-ph/9503016.pdf
- Iten et al., 2015. https://arxiv.org/abs/1501.06911
Create new MCX gate.
Methods
Parameters
get_num_ancilla_qubits
static get_num_ancilla_qubits(num_ctrl_qubits, mode='recursion')
Get the number of required ancilla qubits.
Parameters
inverse
inverse(annotated=False)
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