Module for optimizing QIR using pytket.
Project description
pytket-qirpass
This module provides a method to optimize QIR using pytket.
Installation
Python 3.9, 3.10 or 3.11 is required.
From pypi
pip install pytket-qirpass
Locally
The package is built with the flit
backend, so it is first necessary to
install this:
pip install flit
Then to install lfrom the top-level directory (containing pyproject.toml
):
flit install
To run unit tests:
python -m unittest test.test_qirpass
(These take a few minutes to run.)
Usage
This module provides a single function, apply_qirpass
, which takes as input
- some QIR bitcode
- a pytket compilation pass
- a target gateset
and outputs some new QIR bitcode, where the pass has been applied to the basic blocks in the input program, followed by a rebase to the target gateset.
For example:
from pytket_qirpass import apply_qirpass
from pytket.circuit import OpType
from pytket.passes import FullPeepholeOptimise
qir_out = apply_qirpass(
qir_bitcode=qir_in,
comp_pass=FullPeepholeOptimise(allow_swaps=False),
target_1q_gates={OpType.Rx, OpType.Rz},
target_2q_gates={OpType.ZZPhase},
)
Both the input and the output are Python bytes
objects.
Provided the pass preserves the circuit semantics, apply_qirpass
preserves
the QIR semantics.
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
Built Distribution
Hashes for pytket_qirpass-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cec2bd57367eadd13d23e5569a8df8b0210f3f2640e3aa4ce699c50242df6d6 |
|
MD5 | f97e7047e7ba18524506110a537f2f22 |
|
BLAKE2b-256 | 6bc46008be38d371ef204149dfb38d2551bcf182745b3a43b7c44d2436d41d32 |