Find circuit implementations for logical gates of QECCs.
Project description
Hardware-Tailored Logical Gates
This package can be used to compile circuit implementations for logical Clifford gates of quantum error-correcting codes. The main features are:
- works for every stabilizer code (runtime increases with code size),
- works for every logical Clifford gate, and
- by providing a connectivity map of qubits, hardware-tailored circuits can be obtained.
During circuit compilation, the number of two-qubit gates is minimized. By constructing hardware-tailored circuits, further qubit permutations are avoided altogether.
Requirements
A list of Python package dependencies is included in pyproject.toml and are automatically installed together with the package.
Furthermore, a valid Gurobi license is neccesary for the circuit compilation. There exists a wide-range of licences, including one for academic use that is free of charge. You can find further information on the Gurobi downloads page.
Installation
This Python package is available on PyPI and can be installed using pip via
pip install htlogicalgates
Alternatively, you can clone this repository and include it in your project.
License
This package is distributed under the MIT License.
If you want to support work like this, please cite: our paper (tba)
Tutorials
The following sections of this readme, along with more examples and guiding information, can be found as Jupyter notebook tutorials:
How to tailor logical circuits
The main workflow for tailoring a circuit starts with creating three central objects:
import htlogicalgates as htlg
stab_code = htlg.StabilizerCode("4_2_2")
connectivity = htlg.Connectivity("circular", num_qubits=4)
logical_gate = htlg.Circuit(2)
logical_gate.h(0)
After importing the package, we create three objects:
-
First, we create a
StabilizerCodefor which we wish to find a logical circuit. In this example, we pass"4_2_2", which selects the $⟦4,2,2⟧$ color code. Some common codes are predefined (see below), but custom codes can also be specified through a set of stabilizer generators. -
Next, we create a
Connectivitythat stores connections between qubits on the target hardware. Two-qubit gates will only be allowed between connected qubits. For this example, we use a"circular"connectivity onnum_qubits=4qubits. Other predefined connectivities can be queried viahtlg.available_connectivities(). Moreover, a custom connectivity can be created from an adjacency matrix. -
Finally, we initialize a
Circuitwith the number of logical qubits and add a Hadamard gate on the first qubit (note that we count qubits starting at 0). In the following we will tailor a circuit that implements the action of this circuit on the logical level of the stabilizer code.
Note that we created a Connectivity for $n=4$ qubits and a logical Circuit for $k=2$ qubits since we are using the $⟦n=4,k=2,2⟧$-code.
Now we can pass these objects to the function tailor_logical_gate:
circ, status = htlg.tailor_logical_gate(stab_code, connectivity, logical_gate, num_cz_layers=2)
The parameter num_cz_layers determines the number of CZ gate layers in the ansatz circuit. Generally speaking, more CZ layers make the ansatz more expressive and can lead to circuits with less two-qubit gates in total, while increasing runtime. If you can not find a specific gate, try to increase the number of CZ gate layers.
The return value status indicates the state of the optimization:
"Optimal": The returned circuit is optimal in terms of two-qubit gates."Bound {n}": The returned circuit is not optimal in terms of two-qubit games but there is no circuit with less than $n$ two-qubit gates."Infeasible": There is no physical circuit for the given stabilizer code, connectivity, logical circuit, and number of CZ gate layer."Time out": A physical circuit was not found in the given time limit.
If the status message is "Optimal" or "Bound {n}", then circ contains the physical circuit implementation. Otherwise, it is None.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htlogicalgates-0.6.2.tar.gz.
File metadata
- Download URL: htlogicalgates-0.6.2.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5823e4e528332c4e607e3230f74cdac3d727266d8413aa31df5821bcb28e7f6
|
|
| MD5 |
5c84b77b14e3a6166d7b1a9644de5cbe
|
|
| BLAKE2b-256 |
24557f45933c569652b0d628124fd5f6772ab93bb9b50c240d82015f9ff42286
|
Provenance
The following attestation bundles were made for htlogicalgates-0.6.2.tar.gz:
Publisher:
publish-python.yml on erkue/htlogicalgates
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
htlogicalgates-0.6.2.tar.gz -
Subject digest:
b5823e4e528332c4e607e3230f74cdac3d727266d8413aa31df5821bcb28e7f6 - Sigstore transparency entry: 188907564
- Sigstore integration time:
-
Permalink:
erkue/htlogicalgates@f1569c73952d91f05d5eca689a0198e122a84996 -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/erkue
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@f1569c73952d91f05d5eca689a0198e122a84996 -
Trigger Event:
release
-
Statement type:
File details
Details for the file htlogicalgates-0.6.2-py3-none-any.whl.
File metadata
- Download URL: htlogicalgates-0.6.2-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6d90d706ac0e8e5235edae9877f5845dfea6af787204015a262ea1a0e266ce9
|
|
| MD5 |
48230147ed5a4a8bdb0f5d6a352a561d
|
|
| BLAKE2b-256 |
a16d4216091fad29691aed7b932ea760765400c39882229114fb660f25a278a3
|
Provenance
The following attestation bundles were made for htlogicalgates-0.6.2-py3-none-any.whl:
Publisher:
publish-python.yml on erkue/htlogicalgates
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
htlogicalgates-0.6.2-py3-none-any.whl -
Subject digest:
e6d90d706ac0e8e5235edae9877f5845dfea6af787204015a262ea1a0e266ce9 - Sigstore transparency entry: 188907570
- Sigstore integration time:
-
Permalink:
erkue/htlogicalgates@f1569c73952d91f05d5eca689a0198e122a84996 -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/erkue
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@f1569c73952d91f05d5eca689a0198e122a84996 -
Trigger Event:
release
-
Statement type: