ParityOS Qiskit
ParityOS extension adding an interface to Qiskit.
Installation
It is recommended to install this package in a separate Python virtual environment. For example:
# To create a standard Python virtual environment:
python -m venv my_new_venv && source my_new_venv/bin/activate
# Alternatively, to create a Anaconda/Miniconda environment:
conda create --name my_new_conda_env python=<version> && conda activate my_new_conda_env
# or a pyenv environment
pyenv virtualenv <version> my_new_venv && pyenv activate my_new_venv
# or a uv managed environment
uv venv -p <version>
where <version> is a python version and one of [3.11, 3.12, 3.13].
After activating the virtual environment, install via your favorite package manager, e.g.:
# using pip
pip install parityos-qiskit
# using uv
uv pip install parityos-qiskit
Exporter
parityos-qiskit offers an exporter of ParityOS to Qiskit quantum circuits.
from parityos.bits import get_q
from parityos.operators.circuit import Circuit
from parityos.operators.controlled_operator import CNOT
from parityos.operators.elementary_operator import H, Z
from parityos.operators.rotation_operator import RX
from parityos_qiskit.exporter import export_parityos_to_qiskit
# Create circuit qubits.
qubits = [get_q(name) for name in ("a", "b", "c")]
# Create the following circuit as sequence of gates, followed by a measurement of all qubits.
# ┌───────┐┌───┐┌───┐ ┌─┐
# qa: ┤ Rx(2) ├┤ H ├┤ Z ├───┤M├
# └───────┘├───┤└┬─┬┘ └╥┘
# qb: ─────────┤ X ├─┤M├─────╫─
# ┌───┐ └─┬─┘ └╥┘ ┌─┐ ║
# qc: ──┤ H ├────■────╫──┤M├─╫─
# └───┘ ║ └╥┘ ║
# c: 3/═══════════════╩═══╩══╩═
# 1 2 0
circuit = Circuit(
[
RX(qubits[0], 2),
H(qubits[0]),
H(qubits[2]),
CNOT(qubits[2], qubits[1]),
Z(qubits[0]),
]
).measure_all()
# Export to Qiskit.
# Qiskit qubits are integer labeled. Passing `qubits` explicitly controls how ParityOS qubits are
# mapped to Qiskit qubits.
qiskit_result = export_parityos_to_qiskit(circuit, qubits=reversed(qubits))
print(qiskit_result.circuit.draw("text"))
# ┌───┐ ┌─┐
# q_0: ──┤ H ├────■──────────┤M├───
# └───┘ ┌─┴─┐ ┌─┐└╥┘
# q_1: ─────────┤ X ├─────┤M├─╫────
# ┌───────┐├───┤┌───┐└╥┘ ║ ┌─┐
# q_2: ┤ Rx(2) ├┤ H ├┤ Z ├─╫──╫─┤M├
# └───────┘└───┘└───┘ ║ ║ └╥┘
# c: 3/════════════════════╩══╩══╩═
# 1 2 0
print(qiskit_result.qubit_map) # Maps ParityOS qubits to Qiskit Qubit integer labels
# {Qubit(id='c'): 0, Qubit(id='b'): 1, Qubit(id='a'): 2}
print(qiskit_result.cbit_map) # Maps ParityOS cbits to Qiskit Clbit integer labels
# {Cbit(id=0): 0, Cbit(id=1): 1, Cbit(id=2): 2}
License
This software package is made available under the 3-Clause BSD License.
See License.txt for details.
Metadata
Release files for parityos-qiskit 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| parityos_qiskit-0.3.0.tar.gz | 22.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| parityos_qiskit-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.4 kB
Release files / parityos_qiskit-0.3.0.tar.gz
| Download URL | parityos_qiskit-0.3.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d3291ae21d5b515f2af7c9de27d0e45b363e0b3cbc8d066f1d19b5eccfbf220
|
|
BLAKE2b-256 checksum How to use checksums |
9a0caece39c1e7509f35e3120258a9d4708a2b7a5ec1c9b733316c479e806fb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / parityos_qiskit-0.3.0-py3-none-any.whl
| Download URL | parityos_qiskit-0.3.0-py3-none-any.whl |
|---|---|
| Size | 32.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc38c8e57f59b89ee4fd6e7dc36f171577f7de3b968d1c4c3d9ba8246c23ad77
|
|
BLAKE2b-256 checksum How to use checksums |
8ed473e0ce2398f66684f9ae69ae1d393d4f17669e1eac829148aea3aefd5d77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|