Qubit Toaster backend for Qiskit: run Qiskit code on Quantastica "Qubit Toaster" simulator
Project description
Qubit Toaster backend for Qiskit
Allows running Qiskit code on Qubit Toaster - a high performance quantum circuit simulator.
More goodies at https://quantastica.com
Install
pip install quantastica-qiskit-toaster
Usage
Import ToasterBackend into your Qiskit code:
from quantastica.qiskit_toaster import ToasterBackend
Replace Aer.get_backend
with ToasterBackend.get_backend
.
Example
from qiskit import QuantumRegister, ClassicalRegister
from qiskit import QuantumCircuit, execute, Aer
from quantastica.qiskit_toaster import ToasterBackend
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 = ToasterBackend.get_backend("qasm_simulator")
# OR (to use statevector_simulator backend):
# backend = ToasterBackend.get_backend("statevector_simulator")
# OR (to specify custom toaster_host and toaster_port params
# default values are localhost and 8001 respectively):
# backend = ToasterBackend.get_backend(
# "statevector_simulator",
# toaster_host="192.168.1.2",
# toaster_port=8888,
# )
job = execute(qc, backend=backend)
# To speed things up a little bit qiskit's optimization can be disabled
# by setting optimization_level to 0 like following:
# job = execute(qc, backend=backend, optimization_level=0)
job_result = job.result()
print(job_result.get_counts(qc))
Details
Syntax
ToasterBackend.get_backend(backend_name = None)
Arguments
backend_name
can be:
-
qasm_simulator
only counts will be returned -
statevector_simulator
both counts and state vector will be returned
If backend name is not provided then it will act as qasm_simulator
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-toaster-0.9.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26ef545eeec486e2f96a062931419493ec8ed85b8eaf97694bfdf63251ea9f91 |
|
MD5 | e1d3cad9fea184a5dd1f252f2e6d3a96 |
|
BLAKE2b-256 | 4a8be34e259131f3cc7df44250f140530dcfe980d1f8a8ef8f0b8bb005b77c6a |
Close
Hashes for quantastica_qiskit_toaster-0.9.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5bec223e52e3e6ee0bb9e656cac84221f8c2ff122d47b0dc07bb46426e154dd |
|
MD5 | 844b8a839a341fe895fb76b8c4f54859 |
|
BLAKE2b-256 | 9c468ce917645045832075fb8d69ea6fa25908f091088487283961bdd2ea9269 |