Skip to main content

Module for optimizing QIR using pytket.

Project description

pytket-qirpass

This module provides a method to optimize QIR using pytket.

Installation

Python 3.10, 3.11 or 3.12 is required.

To install from PyPI:

pip install pytket-qirpass

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

pytket_qirpass-0.7.0.tar.gz (279.3 kB view details)

Uploaded Source

Built Distribution

pytket_qirpass-0.7.0-py2.py3-none-any.whl (9.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytket_qirpass-0.7.0.tar.gz.

File metadata

  • Download URL: pytket_qirpass-0.7.0.tar.gz
  • Upload date:
  • Size: 279.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for pytket_qirpass-0.7.0.tar.gz
Algorithm Hash digest
SHA256 834db3a73c0a7e06acdd9fe57dec2b60fd7af356b2dca9f1076355da549ad838
MD5 115aa4a11311431a8e1aea1d9864b9d8
BLAKE2b-256 f5a3efc7d2d7fd7bd669510be1d70bd9da564e509ed48f69e9d9ce8c6a483295

See more details on using hashes here.

File details

Details for the file pytket_qirpass-0.7.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytket_qirpass-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 55bd9aa70137a161cecd1cd2be333d1747533d9151eabe5d2daa96edafe60910
MD5 5baa6d574579fdb417a0862ec23873a9
BLAKE2b-256 4aee8471161cd2c2c2b7006b7c4566802f1ff132e4315f8ec53e044713d5e089

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