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)
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 , where the are the rates, and . 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_set | The gate set whose fidelities are being modelled. |
generators | The generators for the noise model. |
input_space | The input space. |
meas_names | The names of the measurements in this model. |
noise_site | Whether each noise map occurs before or after each gate. |
output_space | The output space. |
prep_names | The 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
noise_site
prep_names
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 -qubits, generalizing the usual notion beyond single qubits. A partition is a collection of disjoint sets of qubit indices that covers . Two qubit indices are neighbours if either edge or is in the coupling map, which is drawn from gate_set or defaults to the complete coupling map. Given a partition , two distinct qubit index sets are neighbours if there exists indices and that are neighbours. Similarly, distinct are next-nearest neighbours if there exists a distinct which is neighbours with both and , and so on.
For a given gate, the -local model is built recursively starting with -local terms defined in the argument local_paulis, with -local terms for subsets of size m given by local_paulis[m]. -local terms are built via tensor product of -local terms between pairs of neighbouring subsets. Generally, -local terms are built from the tensor product of -local terms and -local terms on sets of 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 fromgate_set.model_gate_set.coupling_map, or if it isNone, 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 to2. - gate_k – A dictionary mapping gate names to per-gate locality values that override
kfor 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 inqubit_partitions[gate_name], andlocal_paulis[gate_name][k].num_qubitsmust equalk. For Clifford gates,local_paulis[gate_name][k]defaults to all possible non-identity Paulis onkqubits, and for measurement and preparation, it defaults to all Paulis consisting of onkqubits. - noise_site – Dictionary indicating whether to model gate noise as
"before"or"after"the gate.
Returns
A new PauliLindbladModel instance.
Raises
- ValueError – If any
kvalue exceedslen(gate_set.qubit_subset). - ValueError – If
gate_kcontains names not in the gate set. - ValueError – Name not in
gate_setis used in any other dictionary. - ValueError – Any partition is ill-formed.
- ValueError –
local_paulisdoes 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 to2. - gate_k – A dictionary mapping gate names to per-gate locality values that override
kfor 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 .
- 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.