Skip to main content

Quantastica quantum simulator tools

Project description

Forest backend for Qiskit

Allows running Qiskit code on Rigetti simulators and quantum computers.


pip install quantastica-qiskit-forest


  1. Import ForestBackend into your Qiskit code:
from quantastica.qiskit_forest import ForestBackend
  1. Replace Aer.get_backend with ForestBackend.get_backend.


from qiskit import QuantumRegister, ClassicalRegister
from qiskit import QuantumCircuit, execute, Aer
from quantastica.qiskit_forest import ForestBackend

qc = QuantumCircuit()

q = QuantumRegister(2, "q")
c = ClassicalRegister(2, "c")


qc.h(q[0])[0], q[1])

qc.measure(q[0], c[0])
qc.measure(q[1], c[1])

# Instead:
#backend = Aer.get_backend("qasm_simulator")

# Use:
backend = ForestBackend.get_backend("qasm_simulator")

# OR:
# backend = ForestBackend.get_backend("statevector_simulator")
# backend = ForestBackend.get_backend("Aspen-7-28Q-A")
# backend = ForestBackend.get_backend("Aspen-7-28Q-A", as_qvm=True)
# ...

job = execute(qc, backend=backend)
job_result = job.result()




ForestBackend.get_backend(backend_name = None, as_qvm = False)


backend_name can be:

  • any valid Rigetti lattice name


  • qasm_simulator will be sent to QVM as Nq-qvm (where N is number of qubits in the circuit)

  • statevector_simulator will be executed as WavefunctionSimulator.wavefunction()

If backend name is not provided then it will act as qasm_simulator

as_qvm boolean:

  • False (default)

  • True: if backend_name is QPU lattice name, then code will execute on QVM which will mimic QPU

That's it. Enjoy! :)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for quantastica-qiskit-forest, version 0.9.6
Filename, size File type Python version Upload date Hashes
Filename, size quantastica_qiskit_forest-0.9.6-py3-none-any.whl (11.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size quantastica-qiskit-forest-0.9.6.tar.gz (9.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page