Python SDK to BlueQubit app
Project description
BlueQubit Python SDK
BlueQubit Python SDK is a quantum computing SDK that lets you build, optimize, and run quantum circuits on BlueQubit platform from Python. Whether you need quantum simulation on large CPU/GPU devices or quantum circuit optimization at scale, this quantum development kit has you covered.
Quick Start
-
Register on https://app.bluequbit.io and copy the API token.
-
Install Python SDK from PyPI:
pip install bluequbit
- Import and initialize the SDK (importing also Qiskit for circuit building):
import qiskit
import bluequbit
bq_client = bluequbit.init("<token>")
- An example of how to run a Qiskit circuit using the SDK:
qc_qiskit = qiskit.QuantumCircuit(2)
qc_qiskit.h(0)
qc_qiskit.x(1)
job_result = bq_client.run(qc_qiskit, job_name="testing_1")
state_vector = job_result.get_statevector()
# returns a NumPy array of [0. +0.j 0. +0.j 0.70710677+0.j 0.70710677+0.j]
- Here is an example to run the previous code asynchronously:
# This line is non-blocking.
job = bq_client.run(qc_qiskit, job_name="testing_1", asynchronous=True)
# This line blocks until the job is completed.
job_result = bq_client.wait(job.job_id)
# If you want to cancel a pending job.
bq_client.cancel(job.job_id)
- This is how you can use our
mps.cpudevice:
# a 40 qubit GHZ state
num_qubits = 40
qc = qiskit.QuantumCircuit(num_qubits)
qc.h(0)
for i in range(num_qubits - 1):
qc.cx(i, i+1)
qc.measure_all()
options = {
"mps_bond_dimension": 2,
}
result = bq_client.run(qc, device="mps.cpu", options=options) # should take ~30seconds
print(result.get_counts())
The mps.gpu device can be used in the same way.
Note that while mps.gpu is faster, you need to have a certain amount of minimal balance to be able to use it.
- An example of how to use our Pauli Path Simulator to compute observable expectations:
qc = qiskit.QuantumCircuit(3)
qc.h(0)
qc.h(1)
qc.h(2)
qc.ry(0.3, 0)
qc.rz(0.6, 1)
qc.rx(0.7, 2)
# observable
pauli_sum = [
("XYZ", -0.5),
("XXX", 0.2),
("XII", 0.3),
("III", 0.4),
]
options = {
"pauli_path_truncation_threshold": 0.1,
}
result = bq_client.run(qc, device="pauli-path", pauli_sum=pauli_sum, options=options)
expectation_value = result.expectation_value
# returns 0.9411262759533625
- An example of how to run a Pennylane circuit:
import pennylane as qml
from pennylane import numpy as np
# use "bluequbit.cpu" device name to run on CPU
dev = qml.device("bluequbit.cpu", wires=1, token="<token>")
# use "bluequbit.gpu" device name to run on GPU
# dev = qml.device("bluequbit.gpu", wires=1, token="<token>")
@qml.qnode(dev)
def circuit(angle):
qml.RY(angle, wires=0)
return qml.probs(wires=0)
probabilities = circuit(np.pi / 4)
# returns a NumPy array of [0.85355339 0.14644661]
To use the Pennylane plugin, you must have pennylane version 0.39 or above installed.
bluequbit.cpu supports Pennylane circuits with up to 32 qubits (wires).
bluequbit.gpu supports Pennylane circuits with up to 33 qubits (wires).
- This SDK requires Python versions 3.10 or above. The package is tested extensively on Python 3.10.
Full reference
Please find detailed reference at https://app.bluequbit.io/sdk-docs.
Questions and Issues
Please submit questions and issues to info@bluequbit.io.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bluequbit-0.18.4b1.tar.gz.
File metadata
- Download URL: bluequbit-0.18.4b1.tar.gz
- Upload date:
- Size: 87.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17dcb84d4578961159d5bf2f6cc8825ded23d228b561d1a2198852393472828a
|
|
| MD5 |
5ec9331587c761eb7c9c266c36b63cd3
|
|
| BLAKE2b-256 |
e3fd5d955da7797cefa4504cab80ce07dbc739be46d12e275caff1bcf26f329d
|
Provenance
The following attestation bundles were made for bluequbit-0.18.4b1.tar.gz:
Publisher:
release.yml on BlueQubitDev/bluequbit-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bluequbit-0.18.4b1.tar.gz -
Subject digest:
17dcb84d4578961159d5bf2f6cc8825ded23d228b561d1a2198852393472828a - Sigstore transparency entry: 1166723584
- Sigstore integration time:
-
Permalink:
BlueQubitDev/bluequbit-python-sdk@7578ced3b2e711f2b5865feea704fc83d86da3f1 -
Branch / Tag:
refs/tags/v0.18.4b1 - Owner: https://github.com/BlueQubitDev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7578ced3b2e711f2b5865feea704fc83d86da3f1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bluequbit-0.18.4b1-py3-none-any.whl.
File metadata
- Download URL: bluequbit-0.18.4b1-py3-none-any.whl
- Upload date:
- Size: 98.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6bc9ba59c604187b4a392689da5e8c9e14e5c65bdb5bc2d6801ec86828fef06
|
|
| MD5 |
cbdcf190af2d4887699555b9fbc214c7
|
|
| BLAKE2b-256 |
5064eacbbad21d4e3a88267ffbc751f456a3f80c11a386129901cd5de838a3d4
|
Provenance
The following attestation bundles were made for bluequbit-0.18.4b1-py3-none-any.whl:
Publisher:
release.yml on BlueQubitDev/bluequbit-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bluequbit-0.18.4b1-py3-none-any.whl -
Subject digest:
f6bc9ba59c604187b4a392689da5e8c9e14e5c65bdb5bc2d6801ec86828fef06 - Sigstore transparency entry: 1166723637
- Sigstore integration time:
-
Permalink:
BlueQubitDev/bluequbit-python-sdk@7578ced3b2e711f2b5865feea704fc83d86da3f1 -
Branch / Tag:
refs/tags/v0.18.4b1 - Owner: https://github.com/BlueQubitDev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7578ced3b2e711f2b5865feea704fc83d86da3f1 -
Trigger Event:
release
-
Statement type: