- QuantumCircuit.mcx(control_qubits, target_qubit, ancilla_qubits=None, mode='noancilla')¶
The multi-cX gate can be implemented using different techniques, which use different numbers of ancilla qubits and have varying circuit depth. These modes are:
'noancilla': Requires 0 ancilla qubits.
'recursion': Requires 1 ancilla qubit if more than 4 controls are used, otherwise 0.
'v-chain': Requires 2 less ancillas than the number of control qubits.
'v-chain-dirty': Same as for the clean ancillas (but the circuit will be longer).
For the full matrix form of this gate, see the underlying gate documentation.
control_qubits (Sequence[QubitSpecifier]) – The qubits used as the controls.
target_qubit (QubitSpecifier) – The qubit(s) targeted by the gate.
ancilla_qubits (QubitSpecifier | Sequence[QubitSpecifier] | None) – The qubits used as the ancillae, if the mode requires them.
mode (str) – The choice of mode, explained further above.
A handle to the instructions created.
- 예외 발생
ValueError – if the given mode is not known, or if too few ancilla qubits are passed.
AttributeError – if no ancilla qubits are passed, but some are needed.
- 반환 형식