I am using Qiskit's operator flow framework to calculate expectation values of observables. An example composed operator I want to evaluate typically looks like
I want to run this circuit on hardware, but first I am testing using classical backends. Using the code from the opflow tutorial, I use the CircuitSampler class and the included converter as follows:
sampler = of.CircuitSampler(backend=qiskit.Aer.get_backend('aer_simulator_statevector')) sampled_exp_op = sampler.convert(expectation_op_bound) sampled_expect_val = sampled_exp_op.eval()
If I use the 'aer_simulator_statevector' backend I get the correct result. If I use 'aer_simulator' instead, I get the wrong result.
Could someone explain why I am getting two different results?