Skip to main content

qBraid-SDK extension providing support for QIR conversions.

Project description

qbraid-qir-header

CI Documentation Status PyPI version PyPI version License Discord

qBraid-SDK extension providing support for QIR conversions.

Motivation

qir

This project aims to make QIR representations accessible via the qBraid-SDK transpiler, and by doing so, open the door to language-specific conversions from any and all high-level quantum languages supported by qbraid. See QIR Alliance: why do we need it?.

Installation

qBraid-QIR requires Python 3.9 or greater, and can be installed with pip as follows:

pip install qbraid-qir

Optional dependencies

qBraid-QIR offers integrations that require extra (optional) dependencies, which can be installed as follows:

For OpenQASM 3 to QIR conversions, install the qasm3 extra:

pip install 'qbraid-qir[qasm3]'

For Cirq to QIR conversions, install the cirq extra:

pip install 'qbraid-qir[cirq]'

Install from source

You can also install from source by cloning this repository and running a pip install command in the root directory of the repository:

git clone https://github.com/qBraid/qbraid-qir.git
cd qbraid-qir
pip install .

To include optional dependencies when installing from source, use the same "extras_require" format, e.g.

pip install '.[qasm3,cirq]'

Check version

You can view the version of qbraid-qir you have installed within a Python shell as follows:

In [1]: import qbraid_qir

In [2]: qbraid_qir.__version__

Resources

Usage examples

OpenQASM 3 conversions

from qbraid_qir.qasm3 import qasm3_to_qir

program = """
OPENQASM 3;
include "stdgates.inc";

qubit[2] q;
bit[2] c;

h q[0];
cx q[0], q[1];

measure q[0] -> c[0];
measure q[1] -> c[1];
"""

module = qasm3_to_qir(program, name="my-program")

ir = str(module)

Cirq conversions

import cirq
from qbraid_qir.cirq import cirq_to_qir

q0, q1 = cirq.LineQubit.range(2)

circuit = cirq.Circuit(
  cirq.H(q0),
  cirq.CNOT(q0, q1),
  cirq.measure(q0, q1)
)

module = cirq_to_qir(circuit, name="my-circuit")

ir = str(module)

Architecture diagram

qBraid-SDK transpiler hub-and-spokes architecture with qbraid-qir integration (left) mapped to language specific conversion step in QIR abstraction layers (right).

architecture

Contributing

Citation

If you use qBraid-QIR in your research, we kindly request that you cite it appropriately. The BibTeX entry below is aligned with the latest stable release. For the most up-to-date citation details, please refer to CITATION.cff.

@software{Gupta_qBraid-QIR_Python_package_2024,
  author = {Gupta, Harshit and Jain, Rohan and Kushnir, Samuel and Parakh, Priyansh and Hill, Ryan James},
  license = {GPL-3.0},
  month = aug,
  title = {{qBraid-QIR: Python package for QIR conversions, integrations, and utilities.}},
  url = {https://github.com/qBraid/qbraid-qir},
  version = {0.2.2},
  year = {2024}
}

Acknowledgements

This project was conceived in cooperation with the Quantum Open Source Foundation (QOSF).

License

GNU General Public License v3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qbraid_qir-0.2.3.tar.gz (225.6 kB view details)

Uploaded Source

Built Distribution

qbraid_qir-0.2.3-py3-none-any.whl (69.2 kB view details)

Uploaded Python 3

File details

Details for the file qbraid_qir-0.2.3.tar.gz.

File metadata

  • Download URL: qbraid_qir-0.2.3.tar.gz
  • Upload date:
  • Size: 225.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for qbraid_qir-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2993057a648de30c0dab23a329d0cd0e3ee6a676f01c2b62dbccd0b8967573a3
MD5 6483975288eeec371a53fe287a0c202f
BLAKE2b-256 e15665492e3015f0103c4bd56137e4f74762c536c6f698cd627870022b5877f8

See more details on using hashes here.

File details

Details for the file qbraid_qir-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: qbraid_qir-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 69.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for qbraid_qir-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ddd7ceb1b498519f49a892a43e485e39b225829b10dcc3185b738aac5c621d7a
MD5 3008703ae2d9b8180094c4dd9850081d
BLAKE2b-256 4569c389cb91354930006ee7e59fc21d14c950c696ed610defaa0b9bfea8ea06

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