# qiskit.ignis.mitigation.TensoredExpvalMeasMitigator¶

class TensoredExpvalMeasMitigator(amats)[código fonte]

1-qubit tensor product measurement error mitigator.

This class can be used with the qiskit.ignis.mitigation.expectation_value() function to apply measurement error mitigation of local single-qubit measurement errors. Expectation values can also be computed directly using the expectation_value() method.

For measurement mitigation to be applied the mitigator should be calibrated using the qiskit.ignis.mitigation.expval_meas_mitigator_circuits() function and qiskit.ignis.mitigation.ExpvalMeasMitigatorFitter class with the 'tensored' mitigation method.

Initialize a TensorMeasurementMitigator

Parâmetros

amats (List[ndarray]) – list of single-qubit readout error assignment matrices.

__init__(amats)[código fonte]

Initialize a TensorMeasurementMitigator

Parâmetros

amats (List[ndarray]) – list of single-qubit readout error assignment matrices.

Methods

 __init__(amats) Initialize a TensorMeasurementMitigator assignment_fidelity([qubits]) Return the measurement assignment fidelity on the specified qubits. assignment_matrix([qubits]) Return the measurement assignment matrix for specified qubits. expectation_value(counts[, diagonal, …]) Compute the mitigated expectation value of a diagonal observable. mitigation_matrix([qubits]) Return the measurement mitigation matrix for the specified qubits. mitigation_overhead([qubits]) Return the mitigation overhead for expectation value estimation. plot_assignment_matrix([qubits, ax]) Matrix plot of the readout error assignment matrix. plot_mitigation_matrix([qubits, ax]) Matrix plot of the readout error mitigation matrix. required_shots(delta[, qubits]) Return the number of shots required for expectation value estimation. stddev_upper_bound([shots, qubits]) Return an upper bound on standard deviation of expval estimator.
assignment_fidelity(qubits=None)[código fonte]

Return the measurement assignment fidelity on the specified qubits.

The assignment fidelity on N-qubits is defined as $$\sum_{x\in\{0, 1\}^n} P(x|x) / 2^n$$, where $$P(x|x) = \rangle x|A|x\langle$$, and $$A$$ is the assignment_matrix().

Parâmetros

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

Retorna

the assignment fidelity.

Tipo de retorno

float

assignment_matrix(qubits=None)[código fonte]

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$$.

Parâmetros

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

Retorna

the assignment matrix A.

Tipo de retorno

np.ndarray

expectation_value(counts, diagonal=None, qubits=None, clbits=None)[código fonte]

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|$$.

Parâmetros
• counts (Dict) – counts object

• diagonal (Optional[ndarray]) – Optional, the vector of diagonal values for summing the expectation value. If None the the default value is $$[1, -1]^\otimes n$$.

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

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

Retorna

the expectation value and standard deviation.

Tipo de retorno

(float, float)

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 :mathO = 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)[código fonte]

Return the measurement mitigation matrix for the specified qubits.

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

Parâmetros

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

Retorna

the measurement error mitigation matrix $$A^{-1}$$.

Tipo de retorno

np.ndarray

mitigation_overhead(qubits=None)

Return the mitigation overhead for expectation value estimation.

This is the multiplicative factor of extra shots required for estimating a mitigated expectation value with the same accuracy as an unmitigated expectation value.

Parâmetros

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

Retorna

Tipo de retorno

int

plot_assignment_matrix(qubits=None, ax=None)

Matrix plot of the readout error assignment matrix.

Parâmetros
• qubits (list(int)) – Optional, qubits being measured for operator expval.

• ax (axes) – Optional. Axes object to add plot to.

Retorna

the figure axes object.

Tipo de retorno

plt.axes

Levanta

ImportError – if matplotlib is not installed.

plot_mitigation_matrix(qubits=None, ax=None)

Matrix plot of the readout error mitigation matrix.

Parâmetros
• qubits (list(int)) – Optional, qubits being measured for operator expval.

• ax (plt.axes) – Optional. Axes object to add plot to.

Retorna

the figure axes object.

Tipo de retorno

plt.axes

Levanta

ImportError – if matplotlib is not installed.

required_shots(delta, qubits=None)

Return the number of shots required for expectation value estimation.

This is the number of shots required so that $$|\langle O \rangle_{est} - \langle O \rangle_{true}| < \delta$$ with high probability (at least 2/3) and is given by $$4\delta^2 \Gamma^2$$ where $$\Gamma^2$$ is the mitigation_overhead().

Parâmetros
• delta (float) – Error tolerance for expectation value estimator.

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

Retorna

the required shots.

Tipo de retorno

int

stddev_upper_bound(shots=1, qubits=None)

Return an upper bound on standard deviation of expval estimator.

Parâmetros
• shots (int) – Number of shots used for expectation value measurement.

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

Retorna

the standard deviation upper bound.

Tipo de retorno

float