LocalReadoutMitigator#

class qiskit.result.LocalReadoutMitigator(assignment_matrices=None, qubits=None, backend=None)[ソース]#

ベースクラス: BaseReadoutMitigator

1-qubit tensor product readout error mitigator.

Mitigates expectation_value() and quasi_probabilities(). The mitigator should either be calibrated using qiskit experiments, or calculated directly from the backend properties. This mitigation method should be used in case the readout errors of the qubits are assumed to be uncorrelated. For N qubits there are N mitigation matrices, each of size \(2 x 2\) and the mitigation complexity is \(O(2^N)\), so it is more efficient than the CorrelatedReadoutMitigator class.

Initialize a LocalReadoutMitigator

パラメータ:
  • assignment_matrices (List[ndarray] | None) – Optional, list of single-qubit readout error assignment matrices.

  • qubits (Iterable[int] | None) – Optional, the measured physical qubits for mitigation.

  • backend – Optional, backend name.

例外:

QiskitError – matrices sizes do not agree with number of qubits

Attributes

qubits#

The device qubits for this mitigator

settings#

Return settings.

Methods

assignment_matrix(qubits=None)[ソース]#

Return the measurement assignment matrix for specified qubits.

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

パラメータ:

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

戻り値:

the assignment matrix A.

戻り値の型:

np.ndarray

expectation_value(data, diagonal=None, qubits=None, clbits=None, shots=None)[ソース]#

Compute the mitigated expectation value of a diagonal observable.

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

パラメータ:
  • 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]^\otimes n\).

  • qubits (Iterable[int] | None) – Optional, the measured physical qubits the count bitstrings correspond to. If None qubits are assumed to be \([0, ..., n-1]\).

  • clbits (List[int] | None) – Optional, if not None marginalize counts to the specified bits.

  • shots (int | None) – the number of shots.

戻り値:

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

戻り値の型:

(float, float)

Additional Information:

The diagonal observable \(O\) is input using the diagonal kwarg as a list or Numpy array \([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(qubits=None)[ソース]#

Return the measurement mitigation matrix for the specified qubits.

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

パラメータ:

qubits (List[int] | int | None) – Optional, qubits being measured for operator expval. if a single int is given, it is assumed to be the index of the qubit in self._qubits

戻り値:

the measurement error mitigation matrix \(A^{-1}\).

戻り値の型:

np.ndarray

quasi_probabilities(data, qubits=None, clbits=None, shots=None)[ソース]#

Compute mitigated quasi probabilities value.

パラメータ:
  • 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.

戻り値:

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.

戻り値の型:

QuasiDistribution

例外:

QiskitError – if qubit and clbit kwargs are not valid.

stddev_upper_bound(shots, qubits=None)[ソース]#

Return an upper bound on standard deviation of expval estimator.

パラメータ:
  • shots (int) – Number of shots used for expectation value measurement.

  • qubits (List[int] | None) – qubits being measured for operator expval.

戻り値:

the standard deviation upper bound.

戻り値の型:

float