FermionSimulator.measure_observable_expectation¶
- FermionSimulator.measure_observable_expectation(circuits, observable, shots, seed=None, num_species=1, get_variance=False)¶
Measure the expectation value of an observable in a state prepared by a given quantum circuit that uses fermionic gates. Measurements are added to the entire register if they are not yet applied in the circuit.
- Parameters:
circuits (
Union
[QuantumCircuit
,List
[QuantumCircuit
]]) – QuantumCircuit applying gates with fermionic generatorsobservable (
FermionicOp
) – A FermionicOp describing an observable of which the expectation value is sampledshots (
int
) – Number of measurement shots taken in case the circuit has measure instructionsseed (
Optional
[int
]) – seed for the random number generator of the measurement simulationnum_species (
int
) – number of different fermionic species described by the circuitsget_variance (
bool
) – If True, also returns an estimate of the variance of the observable
- Raises:
QiskitColdAtomError – if the observable is non-diagonal
- Returns:
List of the measured expectation values of the observables in given circuits variance: List of the estimated variances of of the observables (if get_variance is True)
- Return type:
observable_ev