1
$\begingroup$

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?

$\endgroup$

1 Answer 1

1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.