Skip to main content

Python SDK to BQ app

Project description

Deqart Python SDK

Usage

Interface with the Deqart server

Initialization

import deqart

# If you have run the line below once, subsequent initialization no longer
# requires explicit API token, i.e. deqart.init() without an argument is
# sufficient. This is because the token is automatically saved to
# ~/.config/deqart/config.json.
dq = deqart.init(YOUR_API_TOKEN)

Estimating how long it takes to simulate a circuit

import qiskit

import deqart

dq = deqart.init()

qc = qiskit.QuantumCircuit(2)
qc.h(0)
qc.x(1)

result = dq.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 deqart

dq = deqart.init()

dq.submit_job(qc)
result = dq.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 deqart.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.12b1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

bluequbit-0.0.12b1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file bluequbit-0.0.12b1.tar.gz.

File metadata

  • Download URL: bluequbit-0.0.12b1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for bluequbit-0.0.12b1.tar.gz
Algorithm Hash digest
SHA256 2bf41cde5ab553c53b96f7f5301a8b8a4a49956e7a1c2c31e08f680991cd2e35
MD5 b90353fb423bfd431dc0ebcca2c42e1b
BLAKE2b-256 b689989deb53f688a73f6b5da92635a3033c96bf5981010d422dc22b0678fa96

See more details on using hashes here.

File details

Details for the file bluequbit-0.0.12b1-py3-none-any.whl.

File metadata

  • Download URL: bluequbit-0.0.12b1-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.10.6

File hashes

Hashes for bluequbit-0.0.12b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4599f896a9c751f04920194a91034a91db0850e93292c916247697abd79f36cd
MD5 d5be6b26bb34d5f3465ceb55f6db04e3
BLAKE2b-256 855628cd56a2ce9582ae541c9428ae81c6a6f7df1b2d3f88b24e10d83f608a35

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page