Skip to content

Commit cbaa58c

Browse files
authored
Merge branch 'main' into 2025/03/26-ctrl-ham-sim
2 parents 964ac53 + fa442a5 commit cbaa58c

85 files changed

Lines changed: 4053 additions & 629 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CITATION.cff

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,54 @@
11
# Citation information for this repository. -*- yaml -*-
22
#
3-
# CITATION.cff files provide human- & machine-readable citation information for
4-
# software and datasets. GitHub, Zenodo, and the Zotero browser plugin all use
5-
# CFF files automatically if provided. https://citation-file-format.github.io/.
6-
#
7-
# Tools exist to generate CITATION.cff files from other formats such as BibTeX.
3+
# CITATION.cff provide human- & machine-readable citation info for software and
4+
# datasets. GitHub, Zenodo, and the Zotero browser plugin all use CFF files
5+
# automatically. Tools exist to generate CITATION.cff files from other formats
6+
# such as BibTeX. For more info, visit https://citation-file-format.github.io/.
87
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98

109
cff-version: 1.2.0
11-
message: If you use this software, please cite it using this metadata.
10+
message: >-
11+
Please cite your use of Qualtran using the reference metadata provided here.
1212
13-
# CITATION.cff files describe how to cite software or datasets, with the goal of
14-
# making software and data be citable in their own right. However, sometimes
15-
# projects want citations to go to a paper instead. 'Preferred-citation' serves
16-
# to communicate that. The distinction matters in different situations. If this
17-
# field is present, GitHub uses the value for the "cite this repository" button
18-
# and ignores the rest of this file; conversely, the Zenodo-GitHub integration
19-
# ignores this field when creating an entry for a new software release (because
20-
# the Zenodo entry is specifically about the software in this repository).
13+
# If preferred-citation is present, GitHub uses its value for the "cite this
14+
# repository" button and ignores the rest of this file; conversely, the Zenodo-
15+
# GitHub integration ignores this field when archiving a new software release
16+
# and uses the metadata in the rest of this file.
2117
preferred-citation:
2218
type: misc
23-
authors:
19+
authors: &authors
2420
- family-names: Harrigan
2521
given-names: Matthew P.
22+
affiliation: Google LLC
23+
orcid: https://orcid.org/0000-0001-9412-0553
2624
- family-names: Khattar
2725
given-names: Tanuj
26+
affiliation: Google LLC
27+
orcid: https://orcid.org/0009-0003-5545-3066
2828
- family-names: Yuan
2929
given-names: Charles
30+
affiliation: Massachusetts Institute of Technology
31+
orcid: https://orcid.org/0000-0002-4918-4467
3032
- family-names: Peduri
3133
given-names: Anurudh
34+
affiliation: Ruhr University Bochum
35+
orcid: https://orcid.org/0000-0002-6523-7098
3236
- family-names: Yosri
3337
given-names: Noureldin
38+
affiliation: Google LLC
39+
orcid: https://orcid.org/0000-0003-4169-5745
3440
- family-names: Malone
3541
given-names: Fionn D.
42+
affiliation: Google LLC
43+
orcid: https://orcid.org/0000-0001-9239-0162
3644
- family-names: Babbush
3745
given-names: Ryan
46+
affiliation: Google LLC
47+
orcid: https://orcid.org/0000-0001-6979-9533
3848
- family-names: Rubin
3949
given-names: Nicholas C.
50+
affiliation: Google LLC
51+
orcid: https://orcid.org/0000-0003-3963-1830
4052
title: Expressing and Analyzing Quantum Algorithms with Qualtran
4153
year: 2024
4254
doi: 10.48550/arXiv.2409.04643
@@ -51,29 +63,13 @@ preferred-citation:
5163
# The remaining metadata in this file describes the current software release.
5264

5365
title: Qualtran
54-
authors:
55-
- family-names: Harrigan
56-
given-names: Matt P.
57-
- family-names: Khattar
58-
given-names: Tanuj
59-
- family-names: Yuan
60-
given-names: Charles
61-
- family-names: Peduri
62-
given-names: Anurudh
63-
- family-names: Yosri
64-
given-names: Noureldin
65-
- family-names: Malone
66-
given-names: Fionn D.
67-
- family-names: Babbush
68-
given-names: Ryan
69-
- family-names: Rubin
70-
given-names: Nicholas C.
66+
authors: *authors
7167
abstract: >-
72-
Qualtran (quantum algorithms translator) is a set of abstractions for
73-
representing quantum programs, and a library of quantum algorithms expressed
74-
in that language to support quantum algorithms research.
75-
version: 0.5.0
76-
date-released: 2024-09-10
68+
Qualtran is a set of abstractions for representing quantum programs, and a
69+
library of quantum algorithms expressed in that language to support quantum
70+
algorithms research.
71+
version: 0.6.0
72+
date-released: 2025-04-01
7773
url: https://github.com/quantumlib/Qualtran
7874
repository-code: https://github.com/quantumlib/Qualtran
7975
license: Apache-2.0

README.md

Lines changed: 124 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,156 @@
1-
# Qᴜᴀʟᴛʀᴀɴ
1+
<!-- # Qualtran (title omitted because our logo acts as the title) -->
22

3-
Qᴜᴀʟᴛʀᴀɴ (quantum algorithms translator) is a set of abstractions for representing quantum
4-
programs and a library of quantum algorithms expressed in that language to support quantum
5-
algorithms research.
3+
<div align="center">
4+
<img alt="Qualtran logo" width="340px" src="https://raw.githubusercontent.com/quantumlib/Qualtran/refs/heads/main/docs/_static/qualtran-logo-mode-sensitive.svg">
5+
<br>
66

7-
**Note:** Qualtran is an experimental preview release. We provide no backwards compatibility
8-
guarantees. Some algorithms or library functionality may be incomplete or contain inaccuracies.
9-
Open issues or contact the authors with bug reports or feedback.
7+
Python package for fault-tolerant quantum algorithms research.
108

11-
Subscribe to [qualtran-announce@googlegroups.com](https://groups.google.com/g/qualtran-announce)
12-
to receive the latest news and updates!
9+
[![Licensed under the Apache 2.0 open-source license](https://img.shields.io/badge/License-Apache%202.0-3c60b1.svg?logo=opensourceinitiative\&logoColor=white\&style=flat-square)](https://github.com/quantumlib/qualtran/blob/main/LICENSE)
10+
[![Compatible with Python versions 3.10 and higher](https://img.shields.io/badge/Python-3.10+-6828b2.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
11+
[![Qualtran project on PyPI](https://img.shields.io/pypi/v/qualtran.svg?logo=python&logoColor=white&label=PyPI&style=flat-square&color=9d3bb8)](https://pypi.org/project/qualtran)
1312

14-
## Documentation
13+
[Installation](#installation) &ndash;
14+
[Usage](#usage) &ndash;
15+
[Documentation](#documentation) &ndash;
16+
[Community](#community) &ndash;
17+
[Citation](#citation) &ndash;
18+
[Contact](#contact)
19+
20+
</div>
1521

16-
Documentation is available at https://qualtran.readthedocs.io/
22+
Qualtran is a set of abstractions for representing quantum programs and a library of quantum
23+
algorithms expressed in that language to support quantum algorithms research.
1724

1825
## Installation
1926

20-
Qualtran is being actively developed. We recommend installing from source:
27+
Qualtran is being actively developed. We recommend installing from the source code.
2128

22-
For a local editable copy:
29+
The following commands will clone a copy of the repository, then install the Qualtran package in
30+
your local Python environment as a local editable copy:
2331

24-
git clone https://github.com/quantumlib/Qualtran.git
25-
cd Qualtran/
26-
pip install -e .
32+
```shell
33+
git clone https://github.com/quantumlib/Qualtran.git
34+
cd Qualtran/
35+
pip install -e .
36+
```
2737

2838
You can also install the latest tagged release using `pip`:
2939

30-
pip install qualtran
40+
```shell
41+
pip install qualtran
42+
```
43+
44+
You can also install the latest version of the main branch on GitHub:
45+
46+
```shell
47+
pip install git+https://github.com/quantumlib/Qualtran
48+
```
49+
50+
## Usage
51+
52+
> [!WARNING]
53+
> Qualtran is an experimental preview release. We provide no backwards compatibility guarantees.
54+
> Some algorithms or library functionality may be incomplete or contain inaccuracies. Open issues or
55+
> contact the authors with bug reports or feedback.
56+
57+
You should be able to import the `qualtran` package into your interactive Python environment as
58+
as well as your programs:
59+
60+
```shell
61+
import qualtran
62+
```
63+
64+
If this is successful, you can move on to learning how to
65+
[write bloqs](https://qualtran.readthedocs.io/en/latest/_infra/Bloqs-Tutorial.html) or investigate
66+
the [bloqs library](https://qualtran.readthedocs.io/en/latest/bloqs/index.html#bloqs-library).
67+
68+
## Documentation
69+
70+
Documentation is available at https://qualtran.readthedocs.io/.
3171

32-
You can also install the latest state of the main branch:
72+
## Community
3373

34-
pip install git+https://github.com/quantumlib/Qualtran
74+
Qualtran's community is growing rapidly, and if you'd like to join the [many open-source
75+
contributors] to the Qualtran project, we welcome your participation! We are dedicated to
76+
cultivating an open and inclusive community, and have a [code of conduct].
3577

36-
## Physical Resource Estimation GUI
78+
[many open-source contributors]: https://github.com/quantumlib/Qualtran/graphs/contributors
79+
[code of conduct]: https://github.com/quantumlib/Qualtran/blob/main/CODE_OF_CONDUCT.md
3780

38-
Qualtran provides a GUI for estimating the physical resources (qubits, magic states, runtime, ..etc) needed to run a quantum algorithm. The GUI can be run locally by running:
81+
### Announcements
3982

40-
cd $QUALTRAN_HOME
41-
python -m qualtran.surface_code.ui
83+
You can stay on top of Qualtran news using the approach that best suits your needs:
4284

43-
## Citation
85+
* For releases and major announcements: join the low-volume mailing list [`qualtran-announce`].
86+
* For releases only:
87+
* *Via GitHub notifications*: configure [repository notifications] for Qualtran.
88+
* *Via RSS from GitHub*: subscribe to the GitHub [Qualtran releases feed].
89+
* *Via RSS from PyPI*: subscribe to the [PyPI releases feed] for Qualtran.
4490

45-
When publishing articles or otherwise writing about Qualtran, please cite the
46-
following:
91+
[`qualtran-announce`]: https://groups.google.com/g/qualtran-announce
92+
[repository notifications]: https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/configuring-notifications
93+
[Qualtran releases feed]: https://github.com/quantumlib/Qualtran/releases.atom
94+
[PyPI releases feed]: https://pypi.org/rss/project/qualtran/releases.xml
4795

48-
```latex
96+
### Questions and Discussions
97+
98+
* If you'd like to ask questions and participate in discussions, join the [`qualtran-dev`]
99+
group/mailing list. By joining [`qualtran-dev`], you will also get automated invites to the
100+
biweekly _Qualtran Sync_ meeting (below).
101+
102+
* Would you like to get more involved in Qualtran development? The biweekly _Qualtran Sync_
103+
is a virtual face-to-face meeting of contributors to discuss everything from issues to
104+
ongoing efforts, as well as to ask questions. Become a member of [`qualtran-dev`] to get
105+
an automatic meeting invitation!
106+
107+
[`qualtran-dev`]: https://groups.google.com/g/qualtran-dev
108+
109+
### Issues and Pull Requests
110+
111+
* Do you have a feature request or want to report a bug? [Open an issue on
112+
GitHub] to report it!
113+
* Do you have a code contribution? Read our [contribution guidelines], then
114+
open a [pull request]!
115+
116+
[Open an issue on GitHub]: https://github.com/quantumlib/Qualtran/issues/new/choose
117+
[contribution guidelines]: https://github.com/quantumlib/Qualtran/blob/main/CONTRIBUTING.md
118+
[pull request]: https://help.github.com/articles/about-pull-requests
119+
120+
## Citation<a name="how-to-cite"></a>
121+
122+
When publishing articles or otherwise writing about Qualtran, please cite the following:
123+
124+
```bibtex
49125
@misc{harrigan2024qualtran,
50126
title={Expressing and Analyzing Quantum Algorithms with Qualtran},
51127
author={Matthew P. Harrigan and Tanuj Khattar
52128
and Charles Yuan and Anurudh Peduri and Noureldin Yosri
53129
and Fionn D. Malone and Ryan Babbush and Nicholas C. Rubin},
54130
year={2024},
55131
eprint={2409.04643},
132+
archivePrefix={arXiv},
133+
primaryClass={quant-ph},
56134
doi={10.48550/arXiv.2409.04643},
57135
url={https://arxiv.org/abs/2409.04643},
58136
}
59137
```
138+
139+
## Contact
140+
141+
For any questions or concerns not addressed here, please email quantum-oss-maintainers@google.com.
142+
143+
## Disclaimer
144+
145+
This is not an officially supported Google product.
146+
This project is not eligible for the [Google Open Source Software Vulnerability Rewards
147+
Program](https://bughunters.google.com/open-source-security).
148+
149+
Copyright 2025 Google LLC.
150+
151+
<div align="center">
152+
<a href="https://quantumai.google">
153+
<img width="15%" alt="Google Quantum AI"
154+
src="https://raw.githubusercontent.com/quantumlib/Qualtran/refs/heads/main/docs/_static/quantum-ai-vertical.svg">
155+
</a>
156+
</div>

dev_tools/bibliography.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@
131131
"source": [
132132
"for url, clss in sorted(backrefs.items(), key=lambda x: -len(x[1])):\n",
133133
" text = f'### [{titles[url]}]({url})\\n'\n",
134-
" for cls in clss:\n",
135-
" text += f' - {cls.__name__}\\n'\n",
134+
" class_names = [f'{cls._class_name_in_pkg_()}' for cls in clss]\n",
135+
" for cn in sorted(class_names):\n",
136+
" text += f' - {cn}\\n'\n",
136137
"\n",
137138
" display(Markdown(text))"
138139
]

dev_tools/qualtran_dev_tools/notebook_specs.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@
9292
import qualtran.bloqs.gf_arithmetic.gf2_inverse
9393
import qualtran.bloqs.gf_arithmetic.gf2_multiplication
9494
import qualtran.bloqs.gf_arithmetic.gf2_square
95+
import qualtran.bloqs.gf_poly_arithmetic.gf2_poly_add
96+
import qualtran.bloqs.gf_poly_arithmetic.gf2_poly_add_k
97+
import qualtran.bloqs.gf_poly_arithmetic.gf_poly_split_and_join
9598
import qualtran.bloqs.hamiltonian_simulation.hamiltonian_simulation_by_gqsp
9699
import qualtran.bloqs.mcmt.and_bloq
97100
import qualtran.bloqs.mcmt.controlled_via_and
@@ -578,6 +581,8 @@
578581
qualtran.bloqs.gf_arithmetic.gf2_multiplication._MULTIPLY_BY_CONSTANT_MOD_DOC,
579582
qualtran.bloqs.gf_arithmetic.gf2_multiplication._MULTIPLY_POLY_BY_ONE_PLUS_XK_DOC,
580583
qualtran.bloqs.gf_arithmetic.gf2_multiplication._BINARY_POLYNOMIAL_MULTIPLICATION_DOC,
584+
qualtran.bloqs.gf_arithmetic.gf2_multiplication._GF2_SHIFT_RIGHT_MOD_DOC,
585+
qualtran.bloqs.gf_arithmetic.gf2_multiplication._GF2_MUL_DOC,
581586
],
582587
),
583588
NotebookSpecV2(
@@ -602,6 +607,29 @@
602607
),
603608
]
604609

610+
GF_POLY_ARITHMETIC = [
611+
# --------------------------------------------------------------------------
612+
# ----- Polynomials defined over Galois Fields (GF) Arithmetic --------
613+
# --------------------------------------------------------------------------
614+
NotebookSpecV2(
615+
title='Polynomials over GF($p^m$) - Split and Join',
616+
module=qualtran.bloqs.gf_poly_arithmetic.gf_poly_split_and_join,
617+
bloq_specs=[
618+
qualtran.bloqs.gf_poly_arithmetic.gf_poly_split_and_join._GF_POLY_SPLIT_DOC,
619+
qualtran.bloqs.gf_poly_arithmetic.gf_poly_split_and_join._GF_POLY_JOIN_DOC,
620+
],
621+
),
622+
NotebookSpecV2(
623+
title='Polynomials over GF($2^m$) - Add Constant',
624+
module=qualtran.bloqs.gf_poly_arithmetic.gf2_poly_add_k,
625+
bloq_specs=[qualtran.bloqs.gf_poly_arithmetic.gf2_poly_add_k._GF2_POLY_ADD_K_DOC],
626+
),
627+
NotebookSpecV2(
628+
title='Polynomials over GF($2^m$) - Addition',
629+
module=qualtran.bloqs.gf_poly_arithmetic.gf2_poly_add,
630+
bloq_specs=[qualtran.bloqs.gf_poly_arithmetic.gf2_poly_add._GF2_POLY_ADD_DOC],
631+
),
632+
]
605633

606634
ROT_QFT_PE = [
607635
# --------------------------------------------------------------------------
@@ -933,6 +961,7 @@
933961
('Arithmetic', ARITHMETIC),
934962
('Modular Arithmetic', MOD_ARITHMETIC),
935963
('GF Arithmetic', GF_ARITHMETIC),
964+
('Polynomials over Galois Fields', GF_POLY_ARITHMETIC),
936965
('Rotations', ROT_QFT_PE),
937966
('Block Encoding', BLOCK_ENCODING),
938967
('Optimization', OPTIMIZATION),

dev_tools/qualtran_dev_tools/parse_docstrings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def parse_reference(ref_text: str) -> ReferenceT:
4949
# To match the title and accept as many printable ascii characters as possible
5050
# besides square brackets, I have modified the range approach from
5151
# https://stackoverflow.com/a/31740504.
52-
link_match = re.match(r'^\[([ -Z^-~]+)]\((https?://[\w\d./?=#\-]+)\)\.?\s?(.*)$', ref_text)
52+
link_match = re.match(r'^\[([ -Z^-~]+)]\((https?://[\w\d./?=#\-\(\)]+)\)\.?\s?(.*)$', ref_text)
5353
if link_match:
5454
title = link_match.group(1)
5555
url = link_match.group(2)

dev_tools/qualtran_dev_tools/parse_docstrings_test.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from .parse_docstrings import get_markdown_docstring_lines
14+
import pytest
15+
16+
from .bloq_finder import get_bloq_classes
17+
from .parse_docstrings import get_markdown_docstring_lines, get_references, UnparsedReference
1518

1619

1720
class ClassWithDocstrings:
@@ -40,3 +43,16 @@ def test_get_markdown_docstring_lines():
4043
' - [Google](www.google.com). Brin et. al. 1999.',
4144
'',
4245
]
46+
47+
48+
@pytest.mark.slow
49+
def test_parse_all_references():
50+
bloq_classes = get_bloq_classes()
51+
references = {bloq_cls: get_references(bloq_cls) for bloq_cls in bloq_classes}
52+
for bloq_cls, refs in references.items():
53+
for ref in refs:
54+
if isinstance(ref, UnparsedReference):
55+
raise AssertionError(
56+
f"{bloq_cls.__module__}.{bloq_cls.__qualname__} has an incorrectly "
57+
f"formatted reference:\n{ref.text}"
58+
)

0 commit comments

Comments
 (0)