MCXVChain
class qiskit.circuit.library.MCXVChain(num_ctrl_qubits=None, dirty_ancillas=False, label=None, ctrl_state=None, *, _base_label=None, relative_phase=False, action_only=False)
Bases: MCXGate
Implement the multi-controlled X gate using a V-chain of CX gates.
Parameters
- dirty_ancillas (bool) – when set to
True
, the method applies an optimized multicontrolled-X gate up to a relative phase using dirty ancillary qubits with the properties of lemmas 7 and 8 from arXiv:1501.06911, with at most 8*k - 6 CNOT gates. For k within the range {1, …, ceil(n/2)}. And for n representing the total number of qubits. - relative_phase (bool) – when set to
True
, the method applies the optimized multicontrolled-X gate up to a relative phase, in a way that, by lemma 7 of arXiv:1501.06911, the relative phases of theaction part
cancel out with the phases of thereset part
. - action_only (bool) – when set to
True
, the method applies only the action part of lemma 8 from arXiv:1501.06911. - num_ctrl_qubits (Optional[int]) –
- label (Optional[str]) –
- ctrl_state (Optional[Union[str, int]]) –
Methods
get_num_ancilla_qubits
static get_num_ancilla_qubits(num_ctrl_qubits, mode='v-chain')
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