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)
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
Targetagainst which operations will be validated whenever gates are added to the gate set. Its number of qubits must matchnum_qubitsif both are present. - name – Name for this gate set. If
None,namefalls 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 |
|---|---|
label | A string label for use in plotter legends. |
latex_str | A LaTeX string for this gate set. |
math_label | A string label for use within latex math mode. |
model_gate_set | Return a ModelGateSet representing this gate set. |
name | Name for this gate set, defaulting to the class name. |
num_qubits | The total number of qubits of the device this gateset acts on. |
qubit_subset | The indices of the subset of device qubits that all gates act on. |
target | The target of this gateset, if one exists. |
model_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
target
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
- ValueError – If
targetisNone. - ImportError – If
matplotlibis not installed.