# Load a simulation backend. Depending on the Qiskit installation, either
# a simulator from qiskit-aer or a basic simulator from qiskit-terra is used.
try:
# If qiskit-aer is installed: use the backends from this package.
fromqiskitimportAer
backend=Aer.get_backend('qasm_simulator')
MAX_QUBITS=14
except:
# If qiskit-aer is can not be loaded: use the basic backends provided by qiskit-terra.
fromqiskitimportBasicAer
backend=BasicAer.get_backend('qasm_simulator')
# The basic backend is slow compared to the backend in Aer.
print('WARNING: using the slow simulation backend from qiskit-terra.\nFaster simulations with more qubits and shots are possible if qiskit-aer is installed.')
MAX_QUBITS=9
### SIMULATE REAL DEVICE
# If you want to simulate a real quantum device, you can use this backend:
# The basic backend is slow compared to the backend in Aer.
print('WARNING: using the slow simulation backend from qiskit-terra.\nFaster simulations with more qubits and shots are possible if qiskit-aer is installed.')