---
title: Gate (latest version)
description: API reference for qiskit_noise_learning.gate_sets.Gate in the latest version of qiskit-noise-learning
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit-noise-learning/generated/gate-sets-gate
---

# qiskit\_noise\_learning.gate\_sets.Gate

*class* `qiskit_noise_learning.gate_sets.Gate(name: str, qubit_idxs: Iterable[int], prep_idxs: Iterable[int] = (), meas_idxs: Iterable[int] = (), latex_str: str | None = None)`

[GitHub](https://github.com/Qiskit/qiskit-noise-learning/tree/stable/0.1/qiskit_noise_learning/gate_sets/gate.py)

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC)

Represents qubit metadata for a single gate in a gate set.

Typically serves as a base class for types that implement non-trivial gates.

**Parameters**

- **name** – The gate name.
- **qubit\_idxs** – The physical qubit indices that the gate acts on.
- **prep\_idxs** – The physical qubit indices that this gate prepares, or resets to the 0 state.
- **meas\_idxs** – The physical qubit indices that this gate measures.
- **latex\_str** – An optional LaTeX string for rendering this gate.

### \_\_init\_\_

`__init__(name: str, qubit_idxs: Iterable[int], prep_idxs: Iterable[int] = (), meas_idxs: Iterable[int] = (), latex_str: str | None = None)`

## Methods

|                                                                                                                                                     |   |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| [`__init__`](#qiskit_noise_learning.gate_sets.Gate.__init__ "qiskit_noise_learning.gate_sets.Gate.__init__")(name, qubit\_idxs\[, prep\_idxs, ...]) |   |

## Attributes

|                                                                                                                                                     |                                                                                                                                                            |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`constituent_gate_idxs`](#qiskit_noise_learning.gate_sets.Gate.constituent_gate_idxs "qiskit_noise_learning.gate_sets.Gate.constituent_gate_idxs") | Iterator over tuples of physical indices that specify where constituent gates act.                                                                         |
| [`gate_idxs`](#qiskit_noise_learning.gate_sets.Gate.gate_idxs "qiskit_noise_learning.gate_sets.Gate.gate_idxs")                                     | The physical indices where this gate undergoes unitary action.                                                                                             |
| [`idling_idxs`](#qiskit_noise_learning.gate_sets.Gate.idling_idxs "qiskit_noise_learning.gate_sets.Gate.idling_idxs")                               | The physical qubit indices that this gate is idling on.                                                                                                    |
| [`label`](#qiskit_noise_learning.gate_sets.Gate.label "qiskit_noise_learning.gate_sets.Gate.label")                                                 | A string label for use in plotter legends.                                                                                                                 |
| [`latex_str`](#qiskit_noise_learning.gate_sets.Gate.latex_str "qiskit_noise_learning.gate_sets.Gate.latex_str")                                     | A LaTeX string for this gate.                                                                                                                              |
| [`math_label`](#qiskit_noise_learning.gate_sets.Gate.math_label "qiskit_noise_learning.gate_sets.Gate.math_label")                                  | A string label for use within latex math mode.                                                                                                             |
| [`meas_idxs`](#qiskit_noise_learning.gate_sets.Gate.meas_idxs "qiskit_noise_learning.gate_sets.Gate.meas_idxs")                                     | The physical qubit indices that this gate measures.                                                                                                        |
| [`model_gate`](#qiskit_noise_learning.gate_sets.Gate.model_gate "qiskit_noise_learning.gate_sets.Gate.model_gate")                                  | Return a [`ModelGate`](/docs/api/qiskit-noise-learning/generated/gate-sets-model-gate "qiskit_noise_learning.gate_sets.ModelGate") representing this gate. |
| [`name`](#qiskit_noise_learning.gate_sets.Gate.name "qiskit_noise_learning.gate_sets.Gate.name")                                                    | The gate name.                                                                                                                                             |
| [`num_qubits`](#qiskit_noise_learning.gate_sets.Gate.num_qubits "qiskit_noise_learning.gate_sets.Gate.num_qubits")                                  | The number of qubits this gate acts on.                                                                                                                    |
| [`prep_idxs`](#qiskit_noise_learning.gate_sets.Gate.prep_idxs "qiskit_noise_learning.gate_sets.Gate.prep_idxs")                                     | The physical qubit indices that this gate prepares (or resets).                                                                                            |
| [`qubit_idxs`](#qiskit_noise_learning.gate_sets.Gate.qubit_idxs "qiskit_noise_learning.gate_sets.Gate.qubit_idxs")                                  | The physical qubit indices this gate acts on.                                                                                                              |
| [`sorted_meas_idxs`](#qiskit_noise_learning.gate_sets.Gate.sorted_meas_idxs "qiskit_noise_learning.gate_sets.Gate.sorted_meas_idxs")                | The indices of the measured qubits in increasing order.                                                                                                    |
| [`sorted_prep_idxs`](#qiskit_noise_learning.gate_sets.Gate.sorted_prep_idxs "qiskit_noise_learning.gate_sets.Gate.sorted_prep_idxs")                | The indices of the reset qubits in increasing order.                                                                                                       |

### model\_gate

*abstract property*

Type: [`ModelGate`](/docs/api/qiskit-noise-learning/generated/gate-sets-model-gate "qiskit_noise_learning.gate_sets.ModelGate")

Return a [`ModelGate`](/docs/api/qiskit-noise-learning/generated/gate-sets-model-gate "qiskit_noise_learning.gate_sets.ModelGate") representing this gate.

### name

Type: [`str`](https://docs.python.org/3/library/stdtypes.html#str)

The gate name.

### latex\_str

Type: [`str`](https://docs.python.org/3/library/stdtypes.html#str)

A LaTeX string for this gate.

### label

Type: [`str`](https://docs.python.org/3/library/stdtypes.html#str)

A string label for use in plotter legends.

### math\_label

Type: [`str`](https://docs.python.org/3/library/stdtypes.html#str)

A string label for use within latex math mode.

### num\_qubits

Type: [`int`](https://docs.python.org/3/library/functions.html#int)

The number of qubits this gate acts on.

### qubit\_idxs

Type: [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple)\[[`int`](https://docs.python.org/3/library/functions.html#int), ...]

The physical qubit indices this gate acts on.

### meas\_idxs

Type: [`frozenset`](https://docs.python.org/3/library/stdtypes.html#frozenset)\[[`int`](https://docs.python.org/3/library/functions.html#int)]

The physical qubit indices that this gate measures.

### sorted\_meas\_idxs

Type: [`list`](https://docs.python.org/3/library/stdtypes.html#list)\[[`int`](https://docs.python.org/3/library/functions.html#int)]

The indices of the measured qubits in increasing order.

### prep\_idxs

Type: [`frozenset`](https://docs.python.org/3/library/stdtypes.html#frozenset)\[[`int`](https://docs.python.org/3/library/functions.html#int)]

The physical qubit indices that this gate prepares (or resets).

### sorted\_prep\_idxs

Type: [`list`](https://docs.python.org/3/library/stdtypes.html#list)\[[`int`](https://docs.python.org/3/library/functions.html#int)]

The indices of the reset qubits in increasing order.

### idling\_idxs

Type: [`set`](https://docs.python.org/3/library/stdtypes.html#set)\[[`int`](https://docs.python.org/3/library/functions.html#int)]

The physical qubit indices that this gate is idling on.

### gate\_idxs

Type: [`frozenset`](https://docs.python.org/3/library/stdtypes.html#frozenset)\[[`int`](https://docs.python.org/3/library/functions.html#int)]

The physical indices where this gate undergoes unitary action.

### constituent\_gate\_idxs

*abstract property*

Type: [`Iterator`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterator)\[[`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple)\[[`int`](https://docs.python.org/3/library/functions.html#int), ...]]

Iterator over tuples of physical indices that specify where constituent gates act.

Some subclasses may not have a meaningful notion of what a “constituent gate” is, because they don’t choose to represent unitary action by some seperable representation. The only contract they need to obey is that the union of all yielded integers is equal to [`gate_idxs`](#qiskit_noise_learning.gate_sets.Gate.gate_idxs "qiskit_noise_learning.gate_sets.Gate.gate_idxs").
