Skip to main content
IBM Quantum Platform

qiskit_noise_learning.gate_sets.GateSet

class qiskit_noise_learning.gate_sets.GateSet(num_qubits: int, qubit_subset: Iterable[int] | None = None, target: Target | None = None, name: str | None = None, latex_str: str | None = None)

GitHub

Bases: Mapping[str, GateType]

A mapping of names to gates with qubit metadata.

Parameters

  • num_qubits – How many qubits the QPU of interest has.
  • qubit_subset – A subset of range(num_qubits) specifying the region of interest of the QPU. All gates added must act within this subset. By default, contains all qubits.
  • target – An optional Target against which operations will be validated whenever gates are added to the gate set. Its number of qubits must match num_qubits if both are present.
  • name – Name for this gate set. If None, name falls back to the class name.
  • latex_str – An optional LaTeX string for rendering this gate set.

__init__

__init__(num_qubits: int, qubit_subset: Iterable[int] | None = None, target: Target | None = None, name: str | None = None, latex_str: str | None = None)


Methods

Column 1
Column 2
__init__(num_qubits[, qubit_subset, target, ...])
add_gate(gate)Add a gate to the gate set.
draw()Draw the device topology with per-gate coloring.
get(k[,d])
items()
keys()
values()

Attributes

Column 1
Column 2
labelA string label for use in plotter legends.
latex_strA LaTeX string for this gate set.
math_labelA string label for use within latex math mode.
model_gate_setReturn a ModelGateSet representing this gate set.
nameName for this gate set, defaulting to the class name.
num_qubitsThe total number of qubits of the device this gateset acts on.
qubit_subsetThe indices of the subset of device qubits that all gates act on.
targetThe target of this gateset, if one exists.

model_gate_set

abstract property

Type: ModelGateSet

Return a ModelGateSet representing this gate set.

name

Type: str

Name for this gate set, defaulting to the class name.

latex_str

Type: str

A LaTeX string for this gate set.

label

Type: str

A string label for use in plotter legends.

math_label

Type: str

A string label for use within latex math mode.

num_qubits

Type: int

The total number of qubits of the device this gateset acts on.

qubit_subset

Type: frozenset[int]

The indices of the subset of device qubits that all gates act on.

target

Type: Target | None

The target of this gateset, if one exists.

add_gate

add_gate(gate: GateType)

Add a gate to the gate set.

Parameters

gate – The gate to add.

Raises

ValueError – If the gate acts on some qubits outside of the valid range, or if the gate name is already used in the gate set.

draw

draw() → InteractiveFigure

Draw the device topology with per-gate coloring.

Each gate’s 2-qubit interactions are drawn as colored edges on the device coupling graph. Gates that act only on single qubits (such as preparation and measurement) are shown as shaped markers on the relevant nodes.

Returns

The figure, with toggleable legends.

Raises

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