Skip to main content
IBM Quantum Platform

qiskit_noise_learning.sequences.FidelityIndex

class qiskit_noise_learning.sequences.FidelityIndex(gate_name: str, pauli: QubitSparsePauli, in_z_idxs: frozenset[int], out_z_idxs: frozenset[int], input_pauli: QubitSparsePauli, output_pauli: QubitSparsePauli, sign_flip: bool, meas_idxs: frozenset[int])

GitHub

Bases: object

Index data for a fidelity in a Pauli-MCM-reset gate set.

Let KK be the number of qubits, [K]={0,...,K−1}[K] = \{0, ..., K-1\}, M⊂[K]M\subset [K] denote the measured qubits, and R⊂[K]R \subset [K] the reset qubits for the gate. For a given gate, each fidelity is specified by:

  • A Pauli on the unmeasured and unreset qubits Q∈P[K]∖(M∪R)Q \in P^{[K]\setminus (M \cup R)},
  • A ZZ-type operator ZxZ^x on the measured qubits, x∈Z2Mx \in Z_2^M, and
  • A ZZ-type operator ZyZ^y on the measured and reset qubits, y∈Z2M∪Ry \in Z_2^{M \cup R}.

This list constitutes the “index data” for a generalized fidelity for a given gate, in the sense that there is a bijection between all generalized fidelities and the above set of all objects satisfying the above description. See Equation (3) of the mathematical formalism for the decomposition in which these appear.

The exponents xx and yy are stored as the sets of qubit indices on which they are non-zero, namely in_z_idxs and out_z_idxs – equivalently, the qubits on which ZxZ^x and ZyZ^y act non-trivially.

The constructor FidelityIndex.from_gate() builds a FidelityIndex from a ModelGate and the above unique index data. Alternatively, FidelityIndex.from_transition() can be used to build an instance from the Pauli transition implied by the index data. The FidelityIndex.__init__() is viewed as a “low-level” constructor which takes all stored properties without validation.

Parameters

  • gate_name – The name of the gate.
  • pauli – A Pauli operator with support on unmeasured and unreset qubits. Note that pauli.num_qubits controls the size of the operators returned by self.transition.
  • in_z_idxs – The qubit indices on which xx is non-zero.
  • out_z_idxs – The qubit indices on which yy is non-zero.
  • input_pauli – The input Pauli of the transition.
  • output_pauli – The output Pauli of the transition.
  • sign_flip – Whether the transition involves a sign flip.
  • meas_idxs – The measurement qubit indices for the gate.

__init__

__init__(gate_name: str, pauli: QubitSparsePauli, in_z_idxs: frozenset[int], out_z_idxs: frozenset[int], input_pauli: QubitSparsePauli, output_pauli: QubitSparsePauli, sign_flip: bool, meas_idxs: frozenset[int])


Methods

Column 1
Column 2
__init__(gate_name, pauli, in_z_idxs, ...)
from_gate(gate, pauli[, in_z_idxs, out_z_idxs])Construct a fidelity index from a gate and unique index data.
from_transition(gate, in_pauli, out_pauli)Construct a fidelity index from a Pauli transition on the quantum registers.
is_valid_for_gate(gate, pauli[, in_z_idxs, ...])Whether the given index data forms a valid fidelity index for the gate.

Attributes

Column 1
Column 2
gate_nameThe name of the gate.
in_z_idxsThe measured qubits carrying a ZZ on the instrument input.
maskThe mask for marginalizing measurement outcomes.
observable_idxsQubit indices of the associated ZZ observable in ascending order.
out_z_idxsThe measured and reset qubits carrying a ZZ on the instrument output.
pauliThe Pauli operator on the Clifford portion of the model gate.
sign_flipWhether the transition associated with this fidelity involves a sign flip.
transitionThe phaseless Pauli operator transition associated with this fidelity index.

from_gate

classmethod from_gate(gate: ModelGate, pauli: QubitSparsePauli, in_z_idxs: frozenset[int] = frozenset({}), out_z_idxs: frozenset[int] = frozenset({})) → Self

Construct a fidelity index from a gate and unique index data.

Parameters

  • gate – The model gate.
  • pauli – A Pauli operator with support on unmeasured and unreset qubits.
  • in_z_idxs – The subset of measurement qubit indices carrying a ZZ on the instrument input.
  • out_z_idxs – The subset of the union of measurement and reset qubit indices carrying a ZZ on the instrument output.

Raises

ValueError – If the provided data is inconsistent with the gate.

is_valid_for_gate

classmethod is_valid_for_gate(gate: ModelGate, pauli: QubitSparsePauli, in_z_idxs: frozenset[int] = frozenset({}), out_z_idxs: frozenset[int] = frozenset({})) → bool

Whether the given index data forms a valid fidelity index for the gate.

This performs the same (side-effect-free) consistency checks as from_gate(), without constructing the index or computing its transition.

Parameters

  • gate – The model gate.
  • pauli – A Pauli operator with support on unmeasured and unreset qubits.
  • in_z_idxs – The subset of measurement qubit indices carrying a ZZ on the instrument input.
  • out_z_idxs – The subset of the union of measurement and reset qubit indices carrying a ZZ on the instrument output.

from_transition

classmethod from_transition(gate: ModelGate, in_pauli: QubitSparsePauli, out_pauli: QubitSparsePauli) → Self

Construct a fidelity index from a Pauli transition on the quantum registers.

This constructor deduces the Pauli and ZZ index sets of a FidelityIndex from the given Pauli transition.

Parameters

  • gate – The model gate.
  • in_pauli – The input Pauli on the quantum register.
  • out_pauli – The output Pauli on the quantum register.

Raises

ValueError – If the pair of Pauli operators do not imply a valid FidelityIndex.

gate_name

Type: str

The name of the gate.

pauli

Type: QubitSparsePauli

The Pauli operator on the Clifford portion of the model gate.

in_z_idxs

Type: frozenset[int]

The measured qubits carrying a ZZ on the instrument input.

out_z_idxs

Type: frozenset[int]

The measured and reset qubits carrying a ZZ on the instrument output.

sign_flip

Type: bool

Whether the transition associated with this fidelity involves a sign flip.

transition

Type: tuple[QubitSparsePauli, QubitSparsePauli]

The phaseless Pauli operator transition associated with this fidelity index.

mask

Type: ndarray[bool]

The mask for marginalizing measurement outcomes.

observable_idxs

Type: list[int]

Qubit indices of the associated ZZ observable in ascending order.

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