{"id":37641671,"url":"https://github.com/erkue/htlogicalgates","last_synced_at":"2026-01-16T11:18:56.327Z","repository":{"id":276971443,"uuid":"915688261","full_name":"erkue/htlogicalgates","owner":"erkue","description":"Hardware-tailored logical circuits for quantum stabilizer codes","archived":false,"fork":false,"pushed_at":"2025-06-03T12:53:38.000Z","size":140,"stargazers_count":15,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-28T05:23:49.181Z","etag":null,"topics":["hardware-tailored","quantum-computing","quantum-error-correction"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/htlogicalgates/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erkue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-12T14:46:00.000Z","updated_at":"2025-09-06T07:48:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"690d7d43-5935-4b5b-97e1-6669b47d514a","html_url":"https://github.com/erkue/htlogicalgates","commit_stats":null,"previous_names":["erkue/htlogicalgates"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/erkue/htlogicalgates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkue%2Fhtlogicalgates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkue%2Fhtlogicalgates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkue%2Fhtlogicalgates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkue%2Fhtlogicalgates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erkue","download_url":"https://codeload.github.com/erkue/htlogicalgates/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erkue%2Fhtlogicalgates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hardware-tailored","quantum-computing","quantum-error-correction"],"created_at":"2026-01-16T11:18:55.701Z","updated_at":"2026-01-16T11:18:56.315Z","avatar_url":"https://github.com/erkue.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hardware-Tailored Logical Gates\n![PyPI - Version](https://img.shields.io/pypi/v/htlogicalgates)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/erkue/htlogicalgates/blob/main/LICENSE)\n[![Tests](https://github.com/erkue/htlogicalgates/actions/workflows/run-tests.yml/badge.svg)](https://github.com/erkue/htlogicalgates/actions/workflows/run-tests.yml)\n[![Unitary Foundation](https://img.shields.io/badge/Supported%20By-UNITARY%20FOUNDATION-brightgreen.svg)](https://unitary.foundation)\n\n\n\nThis package can be used to compile circuit implementations for **logical Clifford gates** of **quantum error-correcting codes**. It is based on [arXiv:2505.20261](https://arxiv.org/abs/2505.20261). The main features are:\n\n- works for **every stabilizer code** (runtime increases with code size),\n- works for **every logical Clifford gate**, and\n- by providing a connectivity map of qubits, **hardware-tailored** circuits can be obtained.\n\nDuring circuit compilation, the number of two-qubit gates is minimized. By constructing **hardware-tailored** circuits, further qubit permutations are avoided altogether.  \n\n## Requirements\n\nA list of Python package dependencies is included in [pyproject.toml](pyproject.toml) and are automatically installed together with the package.\n\nFurthermore, a valid [Gurobi](https://www.gurobi.com/) 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](https://www.gurobi.com/downloads/).\n\n## Installation\n\nThis Python package is available on [PyPI](https://pypi.org/project/htlogicalgates/) and can be installed using `pip` via\n\n```\npip install htlogicalgates\n```\nAlternatively, you can clone this repository and include it in your project.\n\n## License \n\nThis package is distributed under the MIT License.\n\n## Tutorials\n\nThe following sections of this readme, along with more examples and guiding information, can be found as Jupyter notebook tutorials:\n- [Basic Tutorial](doc/tutorial.ipynb)\n- [Advanced Tutorial](doc/tutorial_tailor_multiple_gates.ipynb)\n\n\n\n\n## How to tailor logical circuits\n\nThe main workflow for tailoring a circuit starts with creating three central objects:\n\n```py\nimport htlogicalgates as htlg\n\nstab_code = htlg.StabilizerCode(\"4_2_2\")\nconnectivity = htlg.Connectivity(\"circular\", num_qubits=4)\nlogical_gate = htlg.Circuit(2)\nlogical_gate.h(0)\n```\n\nAfter importing the package, we create three objects:\n\n- First, we create a `StabilizerCode` for 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. \n\n- Next, we create a `Connectivity` that 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 on `num_qubits=4` qubits. Other predefined connectivities can be queried via `htlg.available_connectivities()`. Moreover, a custom connectivity can be created from an adjacency matrix. \n\n- Finally, we initialize a `Circuit` with 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.\n\nNote 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.\n\nNow we can pass these objects to the function `tailor_logical_gate`:\n```py\ncirc, status = htlg.tailor_logical_gate(stab_code, connectivity, logical_gate, num_cz_layers=2)\n```\nThe 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.\n\nThe return value `status` indicates the state of the optimization:\n\n- `\"Optimal\"` : The returned circuit is optimal in terms of two-qubit gates.\n- `\"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.\n- `\"Infeasible\"` : There is no physical circuit for the given stabilizer code, connectivity, logical circuit, and number of CZ gate layer.\n- `\"Time out\"` : A physical circuit was not found in the given time limit.\n\nIf the status message is `\"Optimal\"` or `\"Bound {n}\"`, then `circ` contains the physical circuit implementation. Otherwise, it is `None`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferkue%2Fhtlogicalgates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferkue%2Fhtlogicalgates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferkue%2Fhtlogicalgates/lists"}