Skip to main content

Qubit Reuse By Reset Plugin

This repository contains an experimental transpiler pass called qubit_reuse which is executed at the end of the init stage of transpilation. This pass is based on: Matthew DeCross et al. "Qubit-reuse compilation with mid-circuit measurement and reset" arXiv:2210.0.08039v1

Background

Certain circuits can reduce the number of qubits required to produce results by resetting and re-using existent measured qubits. The order in which certain qubits are chosen is based on their causal cones and the order in which they are measured.

Causal Cones

Let's say we have qubit a x in a DAGCircuit. We can traverse the DAGCircuit from the output node of x by checking all its predecessor nodes. When checking every operation node found, if at any point x interacts with other qubits, via a multi-qubit gate, the qubits in that operation are added to a set. From that point we continue evaluating recursively all the predecessor nodes in that multi-qubit interaction and adding all qubits found into the set, until no more predecessor nodes are left.

When the traversal ends, the set will contain all the qubits whose interactions affect qubit x. That is what we call the causal cone of x.

Order of Measurement

Qubits are re-arranged based on the length of their causal cones in ascending order, i.e. the first to be re-arranged are those with smaller causal cones.

Before re-arranging a qubit, we need to check if there are any qubit that have been measured and is available to re-use. If so, we reset it and apply all operations onto its wire. Otherwise, a new qubit is added and the operations are passed on to that wire.

Installation

This package is not available through pypi, but can be installed by cloning this repository:

git clone https://github.com/qiskit-community/qiskit-qubit-reuse

And then installing locally:

pip install ./qiskit-qubit-reuse

If you have the proper authentication keys, you can install it remotely by using:

pip install git+https://github.com/qiskit-community/qiskit-qubit-reuse

Usage

Once installed, Qiskit is able to detect the qubit_reuse plugin via an entry point. All that needs to be done is to specify the init method in your transpile call by using init_method="qubit_reuse". Use the following example:

from qiskit.circuit.random import random_circuit
from qiskit import transpile
from qiskit.providers.fake_provider import FakeGuadalupeV2

qc = random_circuit(16, 4, measure=True)

transpiled_qc = transpile(qc, backend=FakeGuadalupeV2(), init_method="qubit_reuse")

This entry point provides the option with the least amount of qubits. If you want to specifically use the normal or dual circuit, you can specifcy that by using the qubit_reuse_normal or the qubit_reuse_dual endpoints.

Warning: This plugin should only be used with circuits that contain measurements.

Metadata

Release files for qiskit-qubit-reuse 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qiskit-qubit-reuse 0.0.2
File Size Uploaded Provenance Actions
qiskit-qubit-reuse-0.0.2.tar.gz 10.9 kB Without provenance Details for qiskit-qubit-reuse-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qiskit-qubit-reuse 0.0.2
File Interpreter ABI Platform Actions
qiskit_qubit_reuse-0.0.2-py3-none-any.whl Python 3 none any Details for qiskit_qubit_reuse-0.0.2-py3-none-any.whl

Total release size: 22.8 kB

Release files / qiskit-qubit-reuse-0.0.2.tar.gz

Download URL qiskit-qubit-reuse-0.0.2.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a19546cb51881e234c1cf7b57e7d6e81e11e42ca6a81eed6967603c3a6954c03
BLAKE2b-256 checksum
How to use checksums
37f3aa061998ef302ee837f27de81659460f6d5b263b60528a95107b04c349ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / qiskit_qubit_reuse-0.0.2-py3-none-any.whl

Download URL qiskit_qubit_reuse-0.0.2-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07cc093154ad99024f1fbd71c9dff68898abf641bcaee38aebcb0071cf6f2305
BLAKE2b-256 checksum
How to use checksums
bb6cba8fde32e0deb3111e1958b6c855096410bb363ce5d5485f03cc3b247835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for qiskit-qubit-reuse 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page