Skip to main content

Quantum Development Kit Python Package

Project description

qdk

The Quantum Development Kit (QDK) provides a single, cohesive Python entry point for compiling, simulating, and estimating resources for quantum programs (Q# and OpenQASM), with optional extras for visualization, cloud workflows, and interoperability with Qiskit and Cirq.

Install

To install the core functionality, which include Q# & OpenQASM simulation, compilation, and resource estimation support:

pip install qdk

To include the Jupyter extra, which adds visualizations using Jupyter Widgets in the qdk.widgets submodule and syntax highlighting for Jupyter notebooks in the browser:

pip install "qdk[jupyter]"

To add the Azure Quantum extra, which includes functionality for working with the Azure Quantum service in the qdk.azure submodule:

pip install "qdk[azure]"

For Qiskit integration, which exposes Qiskit interop utilities in the qdk.qiskit submodule:

pip install "qdk[qiskit]"

For Cirq integration, which exposes Cirq interop utilities in the qdk.azure.cirq submodule:

pip install "qdk[cirq]"

To easily install all the above extras:

pip install "qdk[all]"

Quick Start

from qdk import qsharp

result = qsharp.run("{ use q = Qubit(); H(q); return MResetZ(q); }", shots=100)
print(result)

To use widgets (installed via qdk[jupyter] extra):

from qdk.qsharp import eval, run
from qdk.widgets import Histogram

eval("""
operation BellPair() : Result[] {
    use qs = Qubit[2];
    H(qs[0]);CX(qs[0], qs[1]);
    MResetEachZ(qs)
}
""")
results = run("BellPair()", shots=1000, noise=(0.005, 0.0, 0.0))
Histogram(results)

Public API Surface

Submodules:

  • qdk.qsharp – exports the same APIs as the qsharp Python package
  • qdk.openqasm – exports the same APIs as the openqasm submodule of the qsharp Python package.
  • qdk.estimator – exports the same APIs as the estimator submodule of the qsharp Python package.
  • qdk.widgets – exports the Jupyter widgets available from the qsharp-widgets Python package (requires the qdk[jupyter] extra to be installed).
  • qdk.azure – exports the Python APIs available from the azure-quantum Python package (requires the qdk[azure] extra to be installed).
  • qdk.qiskit – exports the same APIs as the interop.qiskit submodule of the qsharp Python package (requires the qdk[qiskit] extra to be installed).

Top level exports

For convenience, the following helpers and types are also importable directly from the qdk root (e.g. from qdk import code, Result). Algorithm execution APIs (like run / estimate) remain under qdk.qsharp or qdk.openqasm.

Symbol Type Origin Description
code module qsharp.code Exposes operations defined in Q# or OpenQASM
init function qsharp.init Initialize/configure the QDK interpreter (target profile, options).
set_quantum_seed function qsharp.set_quantum_seed Deterministic seed for quantum randomness (simulators).
set_classical_seed function qsharp.set_classical_seed Deterministic seed for classical host RNG.
dump_machine function qsharp.dump_machine Emit a structured dump of full quantum state (simulator dependent).
Result class qsharp.Result Measurement result token.
TargetProfile class qsharp.TargetProfile Target capability / profile descriptor.
StateDump class qsharp.StateDump Structured state dump object.
ShotResult class qsharp.ShotResult Multi-shot execution results container.
PauliNoise class qsharp.PauliNoise Pauli channel noise model spec.
DepolarizingNoise class qsharp.DepolarizingNoise Depolarizing noise model spec.
BitFlipNoise class qsharp.BitFlipNoise Bit-flip noise model spec.
PhaseFlipNoise class qsharp.PhaseFlipNoise Phase-flip noise model spec.

Telemetry

This library sends telemetry. Minimal anonymous data is collected to help measure feature usage and performance. All telemetry events can be seen in the source file telemetry_events.py.

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qdk-1.25.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file qdk-1.25.1-py3-none-any.whl.

File metadata

  • Download URL: qdk-1.25.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for qdk-1.25.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e7d660cb69173cb964f73164dbaaeed3e7ebba9fbbffdfed607e35ec155e3e9
MD5 1647c2d3218ec02683bb5a7430cb19a5
BLAKE2b-256 fc1f65221cccb366b8b15a4a24aeae530f189d9b514463070877280bfdd1b941

See more details on using hashes here.

Supported by

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