HierarQcal
HierarQcal is a quantum circuit builder that simplifies circuit design, composition, generation, scaling, and parameter management. It provides an intuitive and dynamic data structure for constructing computation graphs hierarchically. This enables the generation of complex quantum circuit architectures, which is particularly useful for Neural Architecture Search (NAS), where an algorithm can determine the most efficient circuit architecture for a specific task and hardware. HierarQcal also facilitates the creation of hierarchical quantum circuits, such as those resembling tensor tree networks or MERA, with a single line of code. The package is open-source and framework-agnostic, it includes tutorials for Qiskit, PennyLane, and Cirq. Built to address the unique challenges of applying NAS to Quantum Computing, HierarQcal offers a novel approach to explore and optimize quantum circuit architectures.
A robot building itself with artificial intelligence, pencil drawing - generated with Dall E 2
Quick example
Building a Quantum Convolutional Neural Network (QCNN) with one line of code:
from hierarqcal import Qinit, Qcycle, Qmask
hierq = Qinit(8) + (Qcycle(mapping=u) + Qmask("!*", mapping=v))*3
Modular and hierarchical circuit building:
### Reverse binary tree
from hierarqcal import Qinit, Qcycle, Qmask
# motif: level 1
m1_1 = Qcycle(stride=2)
m1_2 = Qmask(global_pattern="*!")
# motif: level 2
m2_1 = m1_1 + m1_2
# motif: level 3
m3_1 = Qinit(8) + m2_1 * 3
$m^3_1\rightarrow \text{QCNN}:$
# extending follows naturally, repeating the above circuit 5 times is just:
m3_1 * 5
Installation
HierarQcal is hosted on pypi and can be installed via pip:
# Based on the quantum computing framework you use, choose one of:
pip install hierarqcal[cirq]
# or
pip install hierarqcal[qiskit]
# or
pip install hierarqcal[pennylane]
The package is quantum computing framework independent, there are helper functions for Cirq, Qiskit and Pennylane to represent the circuits in their respective frameworks. You can also use the the package independent of any framework, if you want to do this just run:
pip install hierarqcal
Tutorial and Documentation
There is a quickstart tutorial containing code examples for qiskit, cirq and pennylane:
For an overview of the package there is this blogpost which might be worht a read. Altough the syntax has changed since then, the overall functionality is still the same. There is also this paper on the arXiv which describes some of the use cases of the package. For specific details see the documentation.
Contributing
We welcome contributions to the project. Please see the contribution guidelines and code of conduct for more information.
License
BSD 3-Clause "New" or "Revised" License, see LICENSE for more information.
Citation
@article{lourensHierarchicalQuantumCircuit2023,
title = {Hierarchical Quantum Circuit Representations for Neural Architecture Search},
author = {Lourens, Matt and Sinayskiy, Ilya and Park, Daniel K. and Blank, Carsten and Petruccione, Francesco},
date = {2023-08-05},
journaltitle = {npj Quantum Information},
shortjournal = {npj Quantum Inf},
volume = {9},
number = {1},
pages = {1--15},
publisher = {{Nature Publishing Group}},
issn = {2056-6387},
doi = {10.1038/s41534-023-00747-z},
url = {https://www.nature.com/articles/s41534-023-00747-z},
issue = {1},
langid = {english},
}
Metadata
Release files for hierarqcal 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hierarqcal-0.5.0.tar.gz | 32.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hierarqcal-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 64.4 kB
Release files / hierarqcal-0.5.0.tar.gz
| Download URL | hierarqcal-0.5.0.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
086eefa34c3dec8f974ab003330e20ada1ceffa4fcc8b997edfd5edc275e6e9e
|
|
BLAKE2b-256 checksum How to use checksums |
5ea1c653b047211b05377c90506148a4cdbb950bd05bf9ea06568fe2c0f699e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / hierarqcal-0.5.0-py3-none-any.whl
| Download URL | hierarqcal-0.5.0-py3-none-any.whl |
|---|---|
| Size | 32.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f64d043c7f01fafa2ffef270e8875f91d9c06f5cfa09e3460bc1394111061f54
|
|
BLAKE2b-256 checksum How to use checksums |
8b4e79606128e380aa3f7afb59824cc4b504f4491ed44d0179d7b166d2edd72f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for hierarqcal 0.5.0
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.