Skip to content

Commit 94d8026

Browse files
authored
Bibliography updates (#1613)
* Bibliography updates * regenerate notebooks
1 parent b1b3d7f commit 94d8026

12 files changed

Lines changed: 54 additions & 25 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.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@
468468
},
469469
"source": [
470470
"## `BiQubitsMixer`\n",
471-
"Implements the COMPARE2 subroutine from the reference (Fig. 1)\n",
471+
"Implements the COMPARE2 subroutine from the reference.\n",
472472
"\n",
473473
"This gates mixes the values in a way that preserves the result of comparison.\n",
474474
"The signature being compared are 2-qubit signature where\n",
@@ -485,7 +485,7 @@
485485
"https://github.com/quantumlib/Qualtran/issues/389\n",
486486
"\n",
487487
"#### References\n",
488-
" - [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).\n"
488+
" - [Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://arxiv.org/abs/1711.10460). Berry et al. 2017. Appendix B. Fig 3.\n"
489489
]
490490
},
491491
{
@@ -582,7 +582,7 @@
582582
"Applies U|a>|b>|0>|0> = |a> |a=b> |(a<b)> |(a>b)>\n",
583583
"\n",
584584
"#### References\n",
585-
" - Supplementary Materials: Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians. Figure 3. https://static-content.springer.com/esm/art%3A10.1038%2Fs41534-018-0071-5/MediaObjects/41534_2018_71_MOESM1_ESM.pdf\n"
585+
" - [Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://arxiv.org/abs/1711.10460). Berry et al. 2017. Appendix B. Fig 5.\n"
586586
]
587587
},
588588
{
@@ -702,7 +702,7 @@
702702
"\n",
703703
"#### References\n",
704704
" - [Encoding Electronic Spectra in Quantum Circuits with Linear T Complexity](https://arxiv.org/abs/1805.03662). \n",
705-
" - [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).\n"
705+
" - [Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians](https://arxiv.org/abs/1711.10460). Berry et al. 2017. Appendix B.\n"
706706
]
707707
},
708708
{

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.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
"\n",
428428
"#### References\n",
429429
" - [Elementary gates for quantum computation](https://arxiv.org/abs/quant-ph/9503016). Barenco et al. 1995. Special case of Lemma 5.4.\n",
430-
" - [Is Controlled(𝑅𝑧(𝜃)) more expensive than Controlled(𝑍𝑡) on the surface code?](https://quantumcomputing.stackexchange.com/a/40012). Adam Zalcman. 2024.\n"
430+
" - [Is Controlled(Rz(theta)) more expensive than Controlled(Z^t) on the surface code?](https://quantumcomputing.stackexchange.com/a/40012). Adam Zalcman. 2024.\n"
431431
]
432432
},
433433
{

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/cryptography/ecc/ecc.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@
357357
"#### References\n",
358358
" - [How to compute a 256-bit elliptic curve private key with only 50 million Toffoli gates](https://arxiv.org/abs/2306.08585). Litinski. 2023. Section 1, eq. (3) and (4).\n",
359359
" - [Quantum resource estimates for computing elliptic curve discrete logarithms](https://arxiv.org/abs/1706.06752). Roetteler et al. 2017. Algorithm 1 and Figure 10.\n",
360-
" - [https://github.com/microsoft/QuantumEllipticCurves/blob/dbf4836afaf7a9fab813cbc0970e65af85a6f93a/MicrosoftQuantumCrypto/EllipticCurves.qs#L456](QuantumQuantumCrypto). `DistinctEllipticCurveClassicalPointAddition`.\n"
360+
" - [Microsoft Quantum Crypto (GitHub)](https://github.com/microsoft/QuantumEllipticCurves/blob/dbf4836afaf7a9fab813cbc0970e65af85a6f93a/MicrosoftQuantumCrypto/EllipticCurves.qs#L456). Jaques et al. 2020. `DistinctEllipticCurveClassicalPointAddition`.\n"
361361
]
362362
},
363363
{

0 commit comments

Comments
 (0)