You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will be used by various methods of the QasmSimulator to return snapshots of expectation value outcomes <M> for some operator M.
Eventually we will allow different input classes for M but for now we will allow N-qubit Operator objects (which can be constructed from other Operators, lists, np.arrays, Paulis, etc). Behind the scenes these should be converted into either pauli expectation value snapshots, or dense matrix snapshots.
The qobj format for Pauli expectation value snapshot params is a list [[coeff, pauli], ...] where coeff is a complex number (JSON: [re, im]), and pauli is a string containing only IXYZ for the Pauli term (qubit 0 to N-1 are characters right to left).
classSnapshotExpectationValue(Snapshot):
__init__(self, label, op, pauli=True, variance=False):
# num_qubits can be inferred form size of operator.# If Pauli is true convert to Pauli expval snapshot# type: "expectation_value_pauli" or ""expectation_value_pauli_with_variance"# otherwise we use general matrix ones# type: "expectation_value_matrix" or ""expectation_value_matrix_with_variance"# See `operations.hpp` for input format# Monkey patch functiondefsnapshot_expectation_value(self, label, op, qubits=None, variance=False):
# If qubits is None snapshot all qubits.circuit.snapshot_expectation_value=snapshot_expectation_value
The text was updated successfully, but these errors were encountered:
What is the expected behavior?
This will be used by various methods of the QasmSimulator to return snapshots of expectation value outcomes
<M>
for some operatorM
.Eventually we will allow different input classes for M but for now we will allow N-qubit
Operator
objects (which can be constructed from other Operators, lists, np.arrays, Paulis, etc). Behind the scenes these should be converted into either pauli expectation value snapshots, or dense matrix snapshots.The qobj format for Pauli expectation value snapshot params is a list
[[coeff, pauli], ...]
wherecoeff
is a complex number (JSON:[re, im]
), andpauli
is a string containing onlyIXYZ
for the Pauli term (qubit 0 to N-1 are characters right to left).The text was updated successfully, but these errors were encountered: