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.9, 3.10 or 3.11 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.2.0.tar.gz (279.9 kB view details)

Uploaded Source

Built Distribution

pytket_qirpass-0.2.0-py2.py3-none-any.whl (8.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytket-qirpass-0.2.0.tar.gz.

File metadata

  • Download URL: pytket-qirpass-0.2.0.tar.gz
  • Upload date:
  • Size: 279.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for pytket-qirpass-0.2.0.tar.gz
Algorithm Hash digest
SHA256 891ea962127173e45612c7d0a5c4555cf693f998936aba4082078d796631c893
MD5 5b0085a39a30f2a5393bb1fb035ad615
BLAKE2b-256 c80d4e06a39c33fe14e842946a9c8d77f5dee582a4a088ed99db235698d72891

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytket_qirpass-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6bb299e6cd3c677a82b6030ecb351c4d2cd605e2972d0dee571579c8c6918204
MD5 cc5a1c2282f74ae0cdfc80a402852d40
BLAKE2b-256 7dab9c0ad5fb3330465be9020045397f6c6019c2a0f543bee2e2e475f5b112ea

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