Skip to main content
IBM Quantum Platform

qiskit_noise_learning.models.PauliLindbladModel

class qiskit_noise_learning.models.PauliLindbladModel(gate_set: GateSet, generators: dict[str, QubitSparsePauliList], noise_site: dict[str, str] | None = None)

GitHub

Bases: LinearMap[GeneratorIndex, FidelityIndex]

A linear mapping from Pauli-Lindblad generator rates to log fidelities.

This model class assumes that every gate in the gate set is either a unitary, a pure preparation (all qubits are prepared and the unitary part is trivial), or a pure measurement (all qubits are measured and the unitary part is trivial). It is further assumed that at least one preparation and at least one measurement gate are present.

The noise model for each gate in this case is a Pauli channel, parameterized in terms of the rates of a Pauli-Lindblad decomposition exp⁡(∑P∈PnrPL(P))\exp(\sum_{P \in \mathcal{P}_n} r_P L(P)), where the rPr_P are the rates, and L(P)=P⋅P−⋅L(P) = P \cdot P - \cdot. In the case of unitary gates, the noise can be modelled as either occuring before or after the ideal unitary.

Parameters

  • gate_set – The gate set whose fidelities are being modelled. To be converted to a ModelGateSet.
  • generators – A dictionary mapping gate name to the set of Pauli-Lindblad generators for the noise model of that gate. The generators for each gate must be unique.
  • noise_site – A dictionary specifying, for each gate name, whether the noise model occurs before or after the gate, indicated with strings "before" and "after". Any unspecified values for the gate set will be populated with default values: "before" for unitary gates and pure measurement gates, and "after" for pure preparation. An error will be raised if a value for pure measurement or preparation is specified that differs from the default.

Raises

ValueError – If the gate set is not of the required form, or if noise_model_before_gate has any invalid values.

__init__

__init__(gate_set: GateSet, generators: dict[str, QubitSparsePauliList], noise_site: dict[str, str] | None = None)


Methods

Column 1
Column 2
__init__(gate_set, generators[, noise_site])
compose(outer)Post-compose: self maps I->O, outer maps O->C, result maps I->C.
k_local(gate_set[, k, gate_k, paulis, ...])Construct a k-local model.
k_partition_local(gate_set[, k, gate_k, ...])Construct a k-local model according to qubit partitions.
left_multiply(matrix)Multiply on the left by an explicit matrix.
pre_compose(inner)Pre-compose: inner maps A->I, self maps I->O, result maps A->O.
projected_output(output_indices, vector)Compute a projection of the map applied to a vector.
rows(output_indices)Construct the sub-matrix whose rows are the given fidelity indices.
to_pauli_lindblad_maps(model_data[, ...])Return a dictionary of PauliLindbladMap for each gate in the model.

Attributes

Column 1
Column 2
gate_setThe gate set whose fidelities are being modelled.
generatorsThe generators for the noise model.
input_spaceThe input space.
meas_namesThe names of the measurements in this model.
noise_siteWhether each noise map occurs before or after each gate.
output_spaceThe output space.
prep_namesThe names of the preparation in this model.

gate_set

Type: ModelGateSet

The gate set whose fidelities are being modelled.

generators

Type: dict[str, QubitSparsePauliList]

The generators for the noise model.

meas_names

Type: set[str]

The names of the measurements in this model.

noise_site

Type: dict[str, str]

Whether each noise map occurs before or after each gate.

prep_names

Type: set[str]

The names of the preparation in this model.

rows

rows(output_indices: Iterable[FidelityIndex]) → IndexedMatrix[FidelityIndex, GeneratorIndex]

Construct the sub-matrix whose rows are the given fidelity indices.

Parameters

output_indices – The fidelity indices labelling the desired rows.

Returns

An IndexedMatrix indexed by the (non-zero) requested fidelity indices and by the generator indices appearing in those rows.

Raises

ValueError – If any fidelity index labels a gate that is not in the model.

k_partition_local

static k_partition_local(gate_set: GateSet, k: int = 2, gate_k: dict[str, int] | None = None, qubit_partitions: dict[str, list[set[int]]] | None = None, local_paulis: dict[str, list[QubitSparsePauliList]] | None = None, noise_site: dict[str, Literal['before', 'after']] | None = None) → Self

Construct a k-local model according to qubit partitions.

Note that the default partition for this method (described below) results in differing default behaviour for this method as compared to PauliLindbladModel.k_local().

This method defines k-locality in terms of partitions of a set of nn-qubits, generalizing the usual notion beyond single qubits. A partition is a collection of disjoint sets of qubit indices that covers {0,...,n−1}\{0, ..., n - 1\}. Two qubit indices i,ji, j are neighbours if either edge (i,j)(i, j) or (j,i)(j, i) is in the coupling map, which is drawn from gate_set or defaults to the complete coupling map. Given a partition PP, two distinct qubit index sets B0,B1∈PB_0, B_1 \in P are neighbours if there exists indices i∈B0i \in B_0 and j∈B1j \in B_1 that are neighbours. Similarly, distinct B0,B1∈PB_0, B_1 \in P are next-nearest neighbours if there exists a distinct B2∈PB_2 \in P which is neighbours with both B0B_0 and B1B_1, and so on.

For a given gate, the kk-local model is built recursively starting with 11-local terms defined in the argument local_paulis, with 11-local terms for subsets of size m given by local_paulis[m]. 22-local terms are built via tensor product of 11-local terms between pairs of neighbouring subsets. Generally, kk-local terms are built from the tensor product of (k−1)(k - 1)-local terms and 11-local terms on sets of kk connected sets.

If no qubit_partition is supplied, the partition of singletons is assumed. If no local_paulis is supplied, the set of all possible Paulis on the given number of qubits is assumed.

Parameters

  • gate_set – The gate set being modelled. Must contain only Clifford, pure preparation, and pure measurement layers. To be converted to a ModelGateSet. The coupling map is drawn from gate_set.model_gate_set.coupling_map, or if it is None, defaults to the complete coupling map.
  • k – The default degree of locality of the model. Applies to all gates not specified in gate_k. Defaults to 2.
  • gate_k – A dictionary mapping gate names to per-gate locality values that override k for the specified gates.
  • qubit_partitions – A dictionary indicating a qubit partition for each gate. Any unspecified partitions will be populated with a default in which qubits are grouped together if they are connected by unitary gate operations.
  • local_paulis – A dictionary indicating the 1-local Paulis to use each qubit partition for each gate. I.e. len(local_paulis[gate_name]) must equal the maximum partition size in qubit_partitions[gate_name], and local_paulis[gate_name][k].num_qubits must equal k. For Clifford gates, local_paulis[gate_name][k] defaults to all possible non-identity Paulis on k qubits, and for measurement and preparation, it defaults to all Paulis consisting of {I,X}\{I, X\} on k qubits.
  • noise_site – Dictionary indicating whether to model gate noise as "before" or "after" the gate.

Returns

A new PauliLindbladModel instance.

Raises

  • ValueError – If any k value exceeds len(gate_set.qubit_subset).
  • ValueError – If gate_k contains names not in the gate set.
  • ValueError – Name not in gate_set is used in any other dictionary.
  • ValueError – Any partition is ill-formed.
  • ValueError – local_paulis does not satisfy the assumed form.

k_local

static k_local(gate_set: GateSet, k: int = 2, gate_k: dict[str, int] | None = None, paulis: dict[str, QubitSparsePauliList] | None = None, noise_site: dict[str, Literal['before', 'after']] | None = None) → Self

Construct a k-local model.

This is equivalent to calling PauliLindbladModel.k_partition_local() with each partition specified as partition of singletons for each gate.

Parameters

  • gate_set – The gate set being modelled. Must contain only Clifford, pure preparation, and pure measurement layers. To be converted to a ModelGateSet.
  • k – The default degree of locality of the model. Applies to all gates not specified in gate_k. Defaults to 2.
  • gate_k – A dictionary mapping gate names to per-gate locality values that override k for the specified gates.
  • paulis – A dictionary indicating the single-qubit Paulis to use in the k-local model for each gate. For Clifford gates, defaults to all single qubit Paulis, and for measurement and preparation, defaults to {I,X}\{I, X\}.
  • noise_site – Dictionary indicating whether to model gate noise as "before" or "after" the gate.

Returns

A new PauliFidelityModel instance.

to_pauli_lindblad_maps

to_pauli_lindblad_maps(model_data: ModelData, include_spam: bool = False) → dict[str, PauliLindbladMap]

Return a dictionary of PauliLindbladMap for each gate in the model.

Parameters

  • model_fit – The fitted model parameters and covariance.
  • include_spam – Whether to include SPAM gates in the output.

Returns

A dictionary from gate names to corresponding noise maps.

Raises

ValueError – If model_data does not contain the correct parameters.

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