Python SDK to BlueQubit app
Project description
BlueQubit Python SDK
Usage
Interface with the BlueQubit server
Initialization
import bluequbit
# If you have run the line below once, subsequent initialization no longer
# requires explicit API token, i.e. bluequbit.init() without an argument is
# sufficient. This is because the token is automatically saved to
# ~/.config/bluequbit/config.json.
dq = bluequbit.init(<YOUR_API_TOKEN>)
Estimating how long it takes to simulate a circuit
import qiskit
import bluequbit
bq_client = bluequbit.init()
qc = qiskit.QuantumCircuit(2)
qc.h(0)
qc.x(1)
result = bq_client.estimate_job_runtime(qc)
print(result)
# Output
# {
# 'device': 'qsim_simulator',
# 'estimate_ms': 100,
# 'num_qubits': 2,
# 'qc': 'UUlTS0lUBQAVAgAAAAAAAAABcQAKaQAIAAAAAgAAAAAAAAAAAAAABAAAAAEAAAAAAAAAAmNpcmN1aXQtNzgAAAAAAAAAAG51bGxxAQAAAAIAAQFxAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASEdhdGVxAAAAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFhHYXRlcQAAAAEAAA==',
# 'warning_message': 'This is just an estimate; the actual runtime may be less or more.'
# }
Submitting a simulation job and retrieving it
import bluequbit
bq_client = bluequbit.init()
bq_client.submit_job(qc)
result = bq_client.search_jobs()
print(result)
# Output
# {
# 'column_names': ['job_id', 'run_status', 'success', 'worker_runtime_ms', 'created_on'],
# 'data': [['4j2u9lb031YgfPpB', 'QUEUED', None, None, '2022-10-20T07:10:20.316Z']], 'total_count': 1
# }
Circuit serialization
You can decode a quantum circuit of Braket/Cirq/Qiskit to/from JSON string.
import bluequbit.circuit_serialization as circuit_serialization
# Example with Cirq circuit
encoded_cirq = circuit_serialization.encode_circuit(qc_cirq)
decoded_cirq = circuit_serialization.decode_circuit(encoded_cirq)
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
bluequbit-0.0.16b1.tar.gz
(13.9 kB
view details)
Built Distribution
File details
Details for the file bluequbit-0.0.16b1.tar.gz
.
File metadata
- Download URL: bluequbit-0.0.16b1.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed1a85ed9c3504851d1009a594eb504edb696645f2e93645aa3c18312a380940 |
|
MD5 | 495177dcedf713b53c9924ecc060b986 |
|
BLAKE2b-256 | a08803c6f14f0dbd9c38175a456c47067742ec05a2e31b5103f343d0d0592355 |
File details
Details for the file bluequbit-0.0.16b1-py3-none-any.whl
.
File metadata
- Download URL: bluequbit-0.0.16b1-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb46374533830ff0b86410befdf216ec85232ffceb47ef74ebda64451f149f87 |
|
MD5 | 9fae6c84e0e602b952043dda4c50dcfa |
|
BLAKE2b-256 | fae92f7a658465150942c832067012a9ee7db73398bacfed3ceac5d44b29d029 |