Quantastica quantum simulator tools
Project description
Forest backend for Qiskit
Allows running Qiskit code on Rigetti simulators and quantum computers.
Install
pip install quantastica-qiskit-forest
Usage
- Import ForestBackend into your Qiskit code:
from quantastica.qiskit_forest import ForestBackend
- Replace
Aer.get_backend
withForestBackend.get_backend
.
Example
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.add_register(q)
qc.add_register(c)
qc.h(q[0])
qc.cx(q[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()
print(job_result.get_counts(qc))
Details
Syntax
ForestBackend.get_backend(backend_name = None, as_qvm = False)
Arguments
backend_name
can be:
- any valid Rigetti lattice name
OR:
-
qasm_simulator
will be sent to QVM asNq-qvm
(whereN
is number of qubits in the circuit) -
statevector_simulator
will be executed asWavefunctionSimulator.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for quantastica-qiskit-forest-0.9.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03a519fd6cd46f0ad4662944e45ca28748c0ab0e0e4742db22c76fced00c4983 |
|
MD5 | 929a5e58aa975baea84aac07d6b988e7 |
|
BLAKE2b-256 | da7fbd4f9a08ef65e4094b8210c6215a0b409b6334138b2f5eaa3e1ebf6793ac |
Close
Hashes for quantastica_qiskit_forest-0.9.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1bbbba9527e91594dec2bc9ec8c4fa5b734eb4d05e2d100a3e61ada3f109ecf |
|
MD5 | 24177a10eff36db8d25a317408b3af3f |
|
BLAKE2b-256 | 29967837d83b52e577f0a5f829786aeebfb71558ca049d2412fa7a319ee185da |