---
title: MCMT (latest version)
description: API reference for qiskit.circuit.library.MCMT in the latest version of qiskit
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.circuit.library.MCMT
---

# MCMT

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

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/circuit/library/generalized_gates/mcmt.py#L27-L120)

Bases: [`QuantumCircuit`](/docs/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.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 qubits is represented as:

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

This default implementation 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`](/docs/api/qiskit/qiskit.circuit.library.MCMTVChain "qiskit.circuit.library.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*](/docs/api/qiskit/qiskit.circuit.Gate "qiskit.circuit.Gate") *| Callable\[\[*[*QuantumCircuit*](/docs/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")*,* [*circuit.Qubit*](/docs/api/qiskit/circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit")*,* [*circuit.Qubit*](/docs/api/qiskit/circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit")*],* [*circuit.Instruction*](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.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 cast to a Gate.
- **num\_ctrl\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The number of control qubits.
- **num\_target\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The number of target qubits.

**Raises**

- [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError) – If the gate cannot be cast to a controlled gate.
- [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError) – If the number of controls or targets is 0.

## Attributes

### num\_ancilla\_qubits

Return the number of ancillas.

### name

Type: `str`

A human-readable name for the circuit.

**Example**

```python
from qiskit import QuantumCircuit

qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
```

```text
my_circuit
```

## Methods

### control

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

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/circuit/library/generalized_gates/mcmt.py#L110-L116)

Return the controlled version of the MCMT circuit.

### inverse

`inverse(annotated=False)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/circuit/library/generalized_gates/mcmt.py#L118-L120)

Return the inverse MCMT circuit, which is itself.

**Parameters**

**annotated** ([*bool*](https://docs.python.org/3/library/functions.html#bool))
