qiskit.circuit.QuantumCircuit.snapshot_expectation_value¶
-
QuantumCircuit.
snapshot_expectation_value
(label, op, qubits, single_shot=False, variance=False)¶ Take a snapshot of expectation value <O> of an Operator.
- Parameters
label (str) – a snapshot label to report the result
op (Operator) – operator to snapshot
qubits (list) – the qubits to snapshot.
single_shot (bool) – return list for each shot rather than average [Default: False]
variance (bool) – compute variance of values [Default: False]
- Returns
with attached instruction.
- Return type
- Raises
ExtensionError – if snapshot is invalid.
Note
This method will be deprecated after the qiskit-aer 0.8 release. It has been superseded by the
qiskit.providers.aer.library.save_expectation_value()
andqiskit.providers.aer.library.save_expectation_value_variance()
circuit methods.