5
$\begingroup$

In Qiskit, there are several ways to choose simulator: one is

from qiskit import Aer
backend = Aer.get_backend('aer_simulator')
result = backend.run(circ).result()

another one is

from qiskit.providers.aer import AerSimulator
backend = AerSimulator()
result=backend.run(circ).result()

,where circ is QuantumCircuit(n). Do they always return the same result?

$\endgroup$

1 Answer 1

4
$\begingroup$

They're functionally equivalent the first approach is primarily just a shortcut that involves less typing to create a simulator backend and also follows the standardized "provider" interface for backends (which honestly makes more sense for remote backends, like real devices or remote simulators). But, both approaches will initialize a new AerSimulator backend object with the default settings and if you run the circuit you will get roughly the same result with either.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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