Skip to content

Commit 3c02e41

Browse files
committed
Bibliography updates
1 parent e768193 commit 3c02e41

8 files changed

Lines changed: 46 additions & 17 deletions

File tree

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/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+
)

qualtran/_infra/bloq.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,3 +573,14 @@ def wire_symbol(
573573

574574
def __str__(self):
575575
return self.__class__.__name__
576+
577+
@classmethod
578+
def _class_name_in_pkg_(cls) -> str:
579+
"""The bloq class's name with its package.
580+
581+
The Qualtran standard library contains a heirarchy of packages under
582+
`qualtran.bloqs.*`. Each bloq class is defined in a module (i.e. the
583+
"*.py" file) and re-exported one level up.
584+
"""
585+
pkg = '.'.join(cls.__module__.split('.')[:-1])
586+
return f'{pkg}.{cls.__name__}'

qualtran/bloqs/arithmetic/comparison.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def _lt_k_symb() -> LessThanConstant:
218218

219219
@frozen
220220
class BiQubitsMixer(GateWithRegisters):
221-
"""Implements the COMPARE2 subroutine from the reference (Fig. 1)
221+
"""Implements the COMPARE2 subroutine from the reference.
222222
223223
This gates mixes the values in a way that preserves the result of comparison.
224224
The signature being compared are 2-qubit signature where
@@ -235,7 +235,8 @@ class BiQubitsMixer(GateWithRegisters):
235235
https://github.com/quantumlib/Qualtran/issues/389
236236
237237
References:
238-
[Supplementary Materials: Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://static-content.springer.com/esm/art%3A10.1038%2Fs41534-018-0071-5/MediaObjects/41534_2018_71_MOESM1_ESM.pdf).
238+
[Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://arxiv.org/abs/1711.10460).
239+
Berry et al. 2017. Appendix B. Fig 3.
239240
"""
240241

241242
is_adjoint: bool = False
@@ -323,9 +324,8 @@ class SingleQubitCompare(GateWithRegisters):
323324
"""Applies U|a>|b>|0>|0> = |a> |a=b> |(a<b)> |(a>b)>
324325
325326
References:
326-
Supplementary Materials: Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians.
327-
Figure 3.
328-
https://static-content.springer.com/esm/art%3A10.1038%2Fs41534-018-0071-5/MediaObjects/41534_2018_71_MOESM1_ESM.pdf
327+
[Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://arxiv.org/abs/1711.10460).
328+
Berry et al. 2017. Appendix B. Fig 5.
329329
"""
330330

331331
is_adjoint: bool = False
@@ -433,7 +433,8 @@ class LessThanEqual(GateWithRegisters, cirq.ArithmeticGate): # type: ignore[mis
433433
References:
434434
[Encoding Electronic Spectra in Quantum Circuits with Linear T Complexity](https://arxiv.org/abs/1805.03662).
435435
436-
[Supplementary Materials: Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://static-content.springer.com/esm/art%3A10.1038%2Fs41534-018-0071-5/MediaObjects/41534_2018_71_MOESM1_ESM.pdf).
436+
[Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://arxiv.org/abs/1711.10460).
437+
Berry et al. 2017. Appendix B.
437438
"""
438439

439440
x_bitsize: 'SymbolicInt'

qualtran/bloqs/basic_gates/rotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ class CRz(Bloq):
514514
[Elementary gates for quantum computation](https://arxiv.org/abs/quant-ph/9503016).
515515
Barenco et al. 1995. Special case of Lemma 5.4.
516516
517-
[Is Controlled(𝑅𝑧(𝜃)) more expensive than Controlled(𝑍𝑡) on the surface code?](https://quantumcomputing.stackexchange.com/a/40012).
517+
[Is Controlled(Rz(theta)) more expensive than Controlled(Z^t) on the surface code?](https://quantumcomputing.stackexchange.com/a/40012).
518518
Adam Zalcman. 2024.
519519
"""
520520

qualtran/bloqs/cryptography/ecc/ec_add_r.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ class ECAddR(Bloq):
7070
[Quantum resource estimates for computing elliptic curve discrete logarithms](https://arxiv.org/abs/1706.06752).
7171
Roetteler et al. 2017. Algorithm 1 and Figure 10.
7272
73-
[https://github.com/microsoft/QuantumEllipticCurves/blob/dbf4836afaf7a9fab813cbc0970e65af85a6f93a/MicrosoftQuantumCrypto/EllipticCurves.qs#L456](QuantumQuantumCrypto).
74-
`DistinctEllipticCurveClassicalPointAddition`.
75-
73+
[Microsoft Quantum Crypto (GitHub)](https://github.com/microsoft/QuantumEllipticCurves/blob/dbf4836afaf7a9fab813cbc0970e65af85a6f93a/MicrosoftQuantumCrypto/EllipticCurves.qs#L456).
74+
Jaques et al. 2020. `DistinctEllipticCurveClassicalPointAddition`.
7675
"""
7776

7877
n: 'SymbolicInt'

qualtran/bloqs/gf_arithmetic/gf2_inverse.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ class GF2Inverse(Bloq):
7979
results from intermediate multiplications.
8080
8181
References:
82-
[Efficient quantum circuits for binary elliptic curve arithmetic: reducing T -gate complexity](https://arxiv.org/abs/1209.6348).
83-
Section 2.3
82+
[Efficient quantum circuits for binary elliptic curve arithmetic: reducing T-gate complexity](https://arxiv.org/abs/1209.6348).
83+
Amento et al. 2012. Section 2.3
8484
85-
[Structure of parallel multipliers for a class of fields GF(2^m)](https://doi.org/10.1016/0890-5401(89)90045-X)
85+
[Structure of parallel multipliers for a class of fields GF(2^m)](https://doi.org/10.1016/0890-5401(89)90045-X).
86+
Itoh and Tsujii. 1989.
8687
"""
8788

8889
bitsize: SymbolicInt

0 commit comments

Comments
 (0)