Skip to main contentIBM Quantum Documentation

CorrelatedReadoutMitigator

class qiskit.result.CorrelatedReadoutMitigator(assignment_matrix, qubits=None)

GitHub

Bases: BaseReadoutMitigator

N-qubit readout error mitigator.

Mitigates expectation_value() and quasi_probabilities(). The mitigation_matrix should be calibrated using qiskit experiments. This mitigation method should be used in case the readout errors of the qubits are assumed to be correlated. The mitigation_matrix of N qubits is of size 2Nx2N2^N x 2^N so the mitigation complexity is O(4N)O(4^N).

Initialize a CorrelatedReadoutMitigator

Parameters

  • assignment_matrix (ndarray) – readout error assignment matrix.
  • qubits (Iterable[int] | None) – Optional, the measured physical qubits for mitigation.

Raises

QiskitError – matrix size does not agree with number of qubits


Attributes

qubits

The device qubits for this mitigator

settings

Return settings.


Methods

assignment_matrix

assignment_matrix(qubits=None)

GitHub

Return the readout assignment matrix for specified qubits.

The assignment matrix is the stochastic matrix AA which assigns a noisy readout probability distribution to an ideal input readout distribution: P(ij)=iAjP(i|j) = \langle i | A | j \rangle.

Parameters

qubits (List[int] | None) – Optional, qubits being measured.

Returns

the assignment matrix A.

Return type

np.ndarray

expectation_value

expectation_value(data, diagonal=None, qubits=None, clbits=None, shots=None)

GitHub

Compute the mitigated expectation value of a diagonal observable.

This computes the mitigated estimator of O=Tr[ρ.O]\langle O \rangle = \text{Tr}[\rho. O] of a diagonal observable O=x{0,1}nO(x)x ⁣xO = \sum_{x\in\{0, 1\}^n} O(x)|x\rangle\!\langle x|.

Parameters

  • data (Counts) – Counts object
  • diagonal (Callable |dict |str |ndarray | None) – Optional, the vector of diagonal values for summing the expectation value. If None the default value is [1,1]n[1, -1]^\otimes n.
  • qubits (Iterable[int] | None) – Optional, the measured physical qubits the count bitstrings correspond to. If None qubits are assumed to be [0,...,n1][0, ..., n-1].
  • clbits (List[int] | None) – Optional, if not None marginalize counts to the specified bits.
  • shots (int | None) – the number of shots.

Returns

the expectation value and an upper bound of the standard deviation.

Return type

(float, float)

Additional Information:

The diagonal observable OO is input using the diagonal kwarg as a list or Numpy array [O(0),...,O(2n1)][O(0), ..., O(2^n -1)]. If no diagonal is specified the diagonal of the Pauli operator :math`O = mbox{diag}(Z^{otimes n}) = [1, -1]^{otimes n}` is used. The clbits kwarg is used to marginalize the input counts dictionary over the specified bit-values, and the qubits kwarg is used to specify which physical qubits these bit-values correspond to as circuit.measure(qubits, clbits).

mitigation_matrix

mitigation_matrix(qubits=None)

GitHub

Return the readout mitigation matrix for the specified qubits.

The mitigation matrix A1A^{-1} is defined as the inverse of the assignment_matrix() AA.

Parameters

qubits (List[int] | None) – Optional, qubits being measured.

Returns

the measurement error mitigation matrix A1A^{-1}.

Return type

np.ndarray

quasi_probabilities

quasi_probabilities(data, qubits=None, clbits=None, shots=None)

GitHub

Compute mitigated quasi probabilities value.

Parameters

  • data (Counts) – counts object
  • qubits (List[int] | None) – qubits the count bitstrings correspond to.
  • clbits (List[int] | None) – Optional, marginalize counts to just these bits.
  • shots (int | None) – Optional, the total number of shots, if None shots will be calculated as the sum of all counts.

Returns

A dictionary containing pairs of [output, mean] where “output”

is the key in the dictionaries, which is the length-N bitstring of a measured standard basis state, and “mean” is the mean of non-zero quasi-probability estimates.

Return type

QuasiDistribution

stddev_upper_bound

stddev_upper_bound(shots)

GitHub

Return an upper bound on standard deviation of expval estimator.

Parameters

shots (int) – Number of shots used for expectation value measurement.

Returns

the standard deviation upper bound.

Return type

float

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