LocalReadoutMitigator
class LocalReadoutMitigator(assignment_matrices=None, qubits=None, backend=None)
Bases: qiskit.result.mitigation.base_readout_mitigator.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 and the mitigation complexity is , so it is more efficient than the CorrelatedReadoutMitigator
class.
Initialize a LocalReadoutMitigator
Parameters
- assignment_matrices (
Optional
[List
[ndarray
]]) – Optional, list of single-qubit readout error assignment matrices. - qubits (
Optional
[Iterable
[int
]]) – Optional, the measured physical qubits for mitigation. - backend – Optional, backend name.
Raises
QiskitError – matrices sizes do not agree with number of qubits
Methods
assignment_matrix
LocalReadoutMitigator.assignment_matrix(qubits=None)
Return the measurement assignment matrix for specified qubits.
The assignment matrix is the stochastic matrix which assigns a noisy measurement probability distribution to an ideal input measurement distribution: .
Parameters
qubits (Optional
[List
[int
]]) – Optional, qubits being measured for operator expval.
Returns
the assignment matrix A.
Return type
np.ndarray
expectation_value
LocalReadoutMitigator.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 of a diagonal observable .
Parameters
- data (
Counts
) – Counts object - diagonal (
Union
[Callable
,dict
,str
,ndarray
,None
]) – Optional, the vector of diagonal values for summing the expectation value. IfNone
the the default value is . - qubits (
Optional
[Iterable
[int
]]) – Optional, the measured physical qubits the count bitstrings correspond to. If None qubits are assumed to be . - clbits (
Optional
[List
[int
]]) – Optional, if not None marginalize counts to the specified bits. - shots (
Optional
[int
]) – 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 is input using the diagonal
kwarg as a list or Numpy array . 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
LocalReadoutMitigator.mitigation_matrix(qubits=None)
Return the measurement mitigation matrix for the specified qubits.
The mitigation matrix is defined as the inverse of the assignment_matrix()
.
Parameters
qubits (Union
[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
Returns
the measurement error mitigation matrix .
Return type
np.ndarray
quasi_probabilities
LocalReadoutMitigator.quasi_probabilities(data, qubits=None, clbits=None, shots=False)
Compute mitigated quasi probabilities value.
Parameters
- data (
Counts
) – counts object - qubits (
Optional
[List
[int
]]) – qubits the count bitstrings correspond to. - clbits (
Optional
[List
[int
]]) – Optional, marginalize counts to just these bits. - shots (
Optional
[bool
]) – the number of shots.
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
QuasiDistibution
Raises
QiskitError – if qubit and clbit kwargs are not valid.
stddev_upper_bound
LocalReadoutMitigator.stddev_upper_bound(shots, qubits=None)
Return an upper bound on standard deviation of expval estimator.
Parameters
- shots (
int
) – Number of shots used for expectation value measurement. - qubits (
Optional
[List
[int
]]) – qubits being measured for operator expval.
Returns
the standard deviation upper bound.
Return type
float
Attributes
qubits
The device qubits for this mitigator
Return type
Tuple
[int
]
settings
Return settings.
Return type
Dict