Skip to main content
IBM Quantum Platform
This page is from an old version of Qiskit SDK Go to the latest version

MCMT

class qiskit.circuit.library.MCMT(gate, num_ctrl_qubits, num_target_qubits)

GitHub

Bases: QuantumCircuit

The multi-controlled multi-target gate, for an arbitrary singly controlled target gate.

For example, the H gate controlled on 3 qubits and acting on 2 target qubit is represented as:

───■────

───■────

───■────
┌──┴───┐
┤0     ├
│  2-H │
┤1     ├
└──────┘

This default implementations requires no ancilla qubits, by broadcasting the target gate to the number of target qubits and using Qiskit’s generic control routine to control the broadcasted target on the control qubits. If ancilla qubits are available, a more efficient variant using the so-called V-chain decomposition can be used. This is implemented in MCMTVChain.

Create a new multi-control multi-target gate.

Deprecated since version 1.4

The class qiskit.circuit.library.generalized_gates.mcmt.MCMT is deprecated as of Qiskit 1.4. It will be removed no earlier than 3 months after the release date. Use MCMTGate instead.

Parameters

  • gate (Gate | Callable[[QuantumCircuit, circuit.Qubit, circuit.Qubit], circuit.Instruction]) – The gate to be applied controlled on the control qubits and applied to the target qubits. Can be either a Gate or a circuit method. If it is a callable, it will be casted to a Gate.
  • num_ctrl_qubits (int) – The number of control qubits.
  • num_target_qubits (int) – The number of target qubits.

Raises


Attributes

num_ancilla_qubits

Return the number of ancillas.

name

Type: str

A human-readable name for the circuit.

Example

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
my_circuit

Methods

control

control(num_ctrl_qubits=1, label=None, ctrl_state=None, annotated=False)

GitHub

Return the controlled version of the MCMT circuit.

inverse

inverse(annotated=False)

GitHub

Return the inverse MCMT circuit, which is itself.

Parameters

annotated (bool) –

Was this page helpful?
Report a bug, typo, or request content on GitHub.