1

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

Typical composed op needed to evaluate.

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?

Hmecher
  • 113
  • 5

1 Answers1

1

The statevector simulator has to do with "ideal" circuits, and the regular simulator does not. See these links: What are the differences between Qiskit's AerSimulator, QasmSimulator and StatevectorSimulator? https://qiskit.org/documentation/stubs/qiskit.providers.aer.AerSimulator.html

Sam_QC
  • 109
  • 10