diff --git a/dev_tools/qualtran_dev_tools/notebook_specs.py b/dev_tools/qualtran_dev_tools/notebook_specs.py index 0f9840569..1a2f84e7c 100644 --- a/dev_tools/qualtran_dev_tools/notebook_specs.py +++ b/dev_tools/qualtran_dev_tools/notebook_specs.py @@ -104,6 +104,8 @@ import qualtran.bloqs.multiplexers.black_box_select import qualtran.bloqs.multiplexers.select_base import qualtran.bloqs.multiplexers.select_pauli_lcu +import qualtran.bloqs.optimization.k_xor_sat +import qualtran.bloqs.optimization.k_xor_sat.guided_hamiltonian import qualtran.bloqs.optimization.k_xor_sat.kikuchi_guiding_state import qualtran.bloqs.phase_estimation.lp_resource_state import qualtran.bloqs.phase_estimation.qubitization_qpe @@ -804,6 +806,21 @@ # ----- Optimization --------------------------------------------------- # -------------------------------------------------------------------------- OPTIMIZATION: List[NotebookSpecV2] = [ + # ----- Preliminaries ------------------------------------------ + NotebookSpecV2( + title='Guided (sparse) Hamiltonian Problem', + module=qualtran.bloqs.optimization.k_xor_sat.guided_hamiltonian.guided_hamiltonian, + bloq_specs=[ + qualtran.bloqs.optimization.k_xor_sat.guided_hamiltonian.guided_hamiltonian._GUIDED_HAMILTONIAN_DOC, + qualtran.bloqs.optimization.k_xor_sat.guided_hamiltonian.guided_hamiltonian._GUIDED_HAMILTONIAN_PHASE_ESTIMATION_DOC, + ], + ), + # ----- Algorithm ------------------------------------------ + NotebookSpecV2( + title='kXOR: Instance load Oracles', + module=qualtran.bloqs.optimization.k_xor_sat.load_kxor_instance, + bloq_specs=[qualtran.bloqs.optimization.k_xor_sat.load_kxor_instance._LOAD_INSTANCE_DOC], + ), NotebookSpecV2( title='Planted Noisy kXOR - Kikuchi Guiding State', module=qualtran.bloqs.optimization.k_xor_sat.kikuchi_guiding_state, @@ -811,7 +828,35 @@ qualtran.bloqs.optimization.k_xor_sat.kikuchi_guiding_state._SIMPLE_GUIDING_STATE_DOC, qualtran.bloqs.optimization.k_xor_sat.kikuchi_guiding_state._GUIDING_STATE_DOC, ], - ) + ), + NotebookSpecV2( + title='Planted Noisy kXOR: Kikuchi Adjacency List', + module=qualtran.bloqs.optimization.k_xor_sat.kikuchi_adjacency_list, + bloq_specs=[ + qualtran.bloqs.optimization.k_xor_sat.kikuchi_adjacency_list._KIKUCHI_NONZERO_INDEX_DOC + ], + ), + NotebookSpecV2( + title='Planted Noisy kXOR: Kikuchi Adjacency Matrix', + module=qualtran.bloqs.optimization.k_xor_sat.kikuchi_adjacency_matrix, + bloq_specs=[ + qualtran.bloqs.optimization.k_xor_sat.kikuchi_adjacency_matrix._KIKUCHI_MATRIX_ENTRY_DOC + ], + ), + NotebookSpecV2( + title='Planted Noisy kXOR: Block-encoding the Kikuchi Matrix', + module=qualtran.bloqs.optimization.k_xor_sat.kikuchi_block_encoding, + bloq_specs=[ + qualtran.bloqs.optimization.k_xor_sat.kikuchi_block_encoding._KIKUCHI_HAMILTONIAN_DOC + ], + ), + NotebookSpecV2( + title='Algorithm: Planted Noisy kXOR', + module=qualtran.bloqs.optimization.k_xor_sat.planted_noisy_kxor, + bloq_specs=[ + qualtran.bloqs.optimization.k_xor_sat.planted_noisy_kxor._PLANTED_NOISY_KXOR_DOC + ], + ), ] # -------------------------------------------------------------------------- diff --git a/docs/bloqs/index.rst b/docs/bloqs/index.rst index 3f0dbbac0..098b1b5ef 100644 --- a/docs/bloqs/index.rst +++ b/docs/bloqs/index.rst @@ -147,7 +147,13 @@ Bloqs Library :maxdepth: 2 :caption: Optimization: + optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian.ipynb + optimization/k_xor_sat/load_kxor_instance.ipynb optimization/k_xor_sat/kikuchi_guiding_state.ipynb + optimization/k_xor_sat/kikuchi_adjacency_list.ipynb + optimization/k_xor_sat/kikuchi_adjacency_matrix.ipynb + optimization/k_xor_sat/kikuchi_block_encoding.ipynb + optimization/k_xor_sat/planted_noisy_kxor.ipynb .. toctree:: :maxdepth: 2 diff --git a/qualtran/bloqs/optimization/k_xor_sat/__init__.py b/qualtran/bloqs/optimization/k_xor_sat/__init__.py index 4cbf2722c..a31a1fe90 100644 --- a/qualtran/bloqs/optimization/k_xor_sat/__init__.py +++ b/qualtran/bloqs/optimization/k_xor_sat/__init__.py @@ -11,5 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from .kikuchi_adjacency_list import KikuchiNonZeroIndex +from .kikuchi_adjacency_matrix import KikuchiMatrixEntry +from .kikuchi_block_encoding import KikuchiHamiltonian, KikuchiMatrixEntry, KikuchiNonZeroIndex from .kikuchi_guiding_state import GuidingState, SimpleGuidingState from .kxor_instance import Constraint, KXorInstance +from .planted_noisy_kxor import AliceTheorem, PlantedNoisyKXOR diff --git a/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/__init__.py b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/__init__.py new file mode 100644 index 000000000..09dfda120 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from .guided_hamiltonian import GuidedHamiltonian, GuidedHamiltonianPhaseEstimation +from .walk_operator import QubitizedWalkOperator diff --git a/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian.ipynb b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian.ipynb new file mode 100644 index 000000000..f8a5eb2d0 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian.ipynb @@ -0,0 +1,311 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e299e7a9", + "metadata": { + "cq.autogen": "title_cell" + }, + "source": [ + "# Guided (sparse) Hamiltonian Problem\n", + "\n", + "Section 4.4.2 Simulating the Kikuchi Hamiltonian\n", + "\n", + "This module contains oracles to implement the block-encoding of the Kikuchi\n", + "Hamiltonian corresponding to an input k-XOR-SAT instance.\n", + "\n", + "References:\n", + " [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1)\n", + " Section 4.4.2 for algorithm. Section 2.4 for definitions and notation." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e2be674c", + "metadata": { + "cq.autogen": "top_imports" + }, + "outputs": [], + "source": [ + "from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", + "from qualtran import QBit, QInt, QUInt, QAny\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", + "from typing import *\n", + "import numpy as np\n", + "import sympy\n", + "import cirq" + ] + }, + { + "cell_type": "markdown", + "id": "8d10248d", + "metadata": { + "cq.autogen": "GuidedHamiltonian.bloq_doc.md" + }, + "source": [ + "## `GuidedHamiltonian`\n", + "Solve the guided (sparse) hamiltonian problem.\n", + "\n", + "Definition 4.8 (modified to accept any block-encoding):\n", + "In the Guided Hamiltonian problem we are given the following as input:\n", + "\n", + "1. A $(\\sqrt{2} s, \\cdot, 0)$-block-encoding of a Hamiltonian $H$ such that $\\|H\\|_\\max \\le s$.\n", + "2. A unitary program that prepares $|\\Psi\\rangle|0^A\\rangle$.\n", + "3. Parameters $\\lambda \\in [-\\Lambda, \\Lambda]$, $\\alpha \\in (0, 1)$, $\\gamma \\in (0, 1]$.\n", + "\n", + "and we should output\n", + "\n", + "- YES (1) if $\\| \\Pi_{\\ge \\lambda} (H) |\\Psi\\rangle \\| \\ge \\gamma$\n", + "- NO (0) if $\\|H\\| \\le (1 - \\alpha) \\lambda$\n", + "\n", + "Note that the above drops the sparse requirement, and accepts any\n", + "$(\\alpha_H, \\cdot, \\cdot)$-block-encoding of $H$.\n", + "In the sparse Hamiltonian case, $\\alpha_H = s$ (where $s$ is the sparsity).\n", + "\n", + "Algorithm (Theorem 4.9):\n", + " This uses phase estimation on the block-encoding of $e^{iHt}$, and then uses\n", + " amplitude amplification to increase the success probability to $1 - o(1)$.\n", + "\n", + "We instead directly do phase-estimation on the qubitized (Szegedy) walk operator for $H$\n", + "\n", + "#### Parameters\n", + " - `hamiltonian`: the block-encoding of $H$\n", + " - `guiding_state`: the unitary that prepares $|\\Psi\\rangle$\n", + " - `lambd`: parameter $\\lambda$\n", + " - `alpha`: parameter $\\alpha$\n", + " - `gamma`: parameter $\\gamma$ \n", + "\n", + "#### References\n", + " - [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1). Section 4.2 \"Guided Sparse Hamiltonian Problem\".\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "29d536c3", + "metadata": { + "cq.autogen": "GuidedHamiltonian.bloq_doc.py" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.guided_hamiltonian import GuidedHamiltonian" + ] + }, + { + "cell_type": "markdown", + "id": "a216ac70", + "metadata": { + "cq.autogen": "GuidedHamiltonian.example_instances.md" + }, + "source": [ + "### Example Instances" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fabf68e4", + "metadata": { + "cq.autogen": "GuidedHamiltonian.guided_hamiltonian" + }, + "outputs": [], + "source": [ + "import sympy\n", + "\n", + "from qualtran.bloqs.optimization.k_xor_sat import GuidingState, KikuchiHamiltonian, KXorInstance\n", + "from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare\n", + "from qualtran.symbolics import ceil, log2\n", + "\n", + "n, k, m, c = sympy.symbols(\"n k m c\", positive=True, integer=True)\n", + "zeta = sympy.symbols(r\"\\zeta\", positive=True)\n", + "\n", + "inst_guide = KXorInstance.symbolic(n, (1 - zeta) * m, k, max_rhs=2)\n", + "inst_solve = KXorInstance.symbolic(n, zeta * m, k, max_rhs=2)\n", + "l = c * k\n", + "s = l * ceil(log2(n))\n", + "\n", + "Psi = GuidingState(inst_guide, l)\n", + "H = KikuchiHamiltonian(inst_solve, c * k, s)\n", + "\n", + "lambd, alpha, gamma = sympy.symbols(r\"\\lambda \\alpha \\gamma\", positive=True, real=True)\n", + "guided_hamiltonian = GuidedHamiltonian(H, BlackBoxPrepare(Psi), lambd, alpha, gamma)" + ] + }, + { + "cell_type": "markdown", + "id": "7ad9d994", + "metadata": { + "cq.autogen": "GuidedHamiltonian.graphical_signature.md" + }, + "source": [ + "#### Graphical Signature" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5ae17ad5", + "metadata": { + "cq.autogen": "GuidedHamiltonian.graphical_signature.py" + }, + "outputs": [], + "source": [ + "from qualtran.drawing import show_bloqs\n", + "show_bloqs([guided_hamiltonian],\n", + " ['`guided_hamiltonian`'])" + ] + }, + { + "cell_type": "markdown", + "id": "1b3e1663", + "metadata": { + "cq.autogen": "GuidedHamiltonian.call_graph.md" + }, + "source": [ + "### Call Graph" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "08946e48", + "metadata": { + "cq.autogen": "GuidedHamiltonian.call_graph.py" + }, + "outputs": [], + "source": [ + "from qualtran.resource_counting.generalizers import ignore_split_join\n", + "guided_hamiltonian_g, guided_hamiltonian_sigma = guided_hamiltonian.call_graph(max_depth=1, generalizer=ignore_split_join)\n", + "show_call_graph(guided_hamiltonian_g)\n", + "show_counts_sigma(guided_hamiltonian_sigma)" + ] + }, + { + "cell_type": "markdown", + "id": "0b22b193", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.bloq_doc.md" + }, + "source": [ + "## `GuidedHamiltonianPhaseEstimation`\n", + "Implement the phase estimation algorithm $U_\\text{PE}$" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b3806eb0", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.bloq_doc.py" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.guided_hamiltonian import GuidedHamiltonianPhaseEstimation" + ] + }, + { + "cell_type": "markdown", + "id": "500f891d", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.example_instances.md" + }, + "source": [ + "### Example Instances" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bfdbf9a6", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.guided_phase_estimate_symb" + }, + "outputs": [], + "source": [ + "import sympy\n", + "\n", + "from qualtran.bloqs.optimization.k_xor_sat import GuidingState, KikuchiHamiltonian, KXorInstance\n", + "from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare\n", + "from qualtran.symbolics import ceil, log2\n", + "\n", + "n, k, c = sympy.symbols(\"n k c\", positive=True, integer=True)\n", + "m_guide, m_solve = sympy.symbols(\"m_1 m_2\", positive=True, integer=True)\n", + "\n", + "inst_guide = KXorInstance.symbolic(n, m_guide, k, max_rhs=2)\n", + "inst_solve = KXorInstance.symbolic(n, m_solve, k, max_rhs=2)\n", + "l = c * k\n", + "s = l * ceil(log2(n))\n", + "\n", + "Psi = GuidingState(inst_guide, l)\n", + "H = KikuchiHamiltonian(inst_solve, c * k, s)\n", + "\n", + "eps, delta = sympy.symbols(r\"\\epsilon_{PE} \\delta_{PE}\", positive=True, real=True)\n", + "guided_phase_estimate_symb = GuidedHamiltonianPhaseEstimation(\n", + " H, BlackBoxPrepare(Psi), eps, delta\n", + ")\n" + ] + }, + { + "cell_type": "markdown", + "id": "d6408318", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.graphical_signature.md" + }, + "source": [ + "#### Graphical Signature" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3a1d74b2", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.graphical_signature.py" + }, + "outputs": [], + "source": [ + "from qualtran.drawing import show_bloqs\n", + "show_bloqs([guided_phase_estimate_symb],\n", + " ['`guided_phase_estimate_symb`'])" + ] + }, + { + "cell_type": "markdown", + "id": "a5d710cd", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.call_graph.md" + }, + "source": [ + "### Call Graph" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "749b6440", + "metadata": { + "cq.autogen": "GuidedHamiltonianPhaseEstimation.call_graph.py" + }, + "outputs": [], + "source": [ + "from qualtran.resource_counting.generalizers import ignore_split_join\n", + "guided_phase_estimate_symb_g, guided_phase_estimate_symb_sigma = guided_phase_estimate_symb.call_graph(max_depth=1, generalizer=ignore_split_join)\n", + "show_call_graph(guided_phase_estimate_symb_g)\n", + "show_counts_sigma(guided_phase_estimate_symb_sigma)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian.py b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian.py new file mode 100644 index 000000000..b7a342f1a --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian.py @@ -0,0 +1,345 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Section 4.4.2 Simulating the Kikuchi Hamiltonian + +This module contains oracles to implement the block-encoding of the Kikuchi +Hamiltonian corresponding to an input k-XOR-SAT instance. + +References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Section 4.4.2 for algorithm. Section 2.4 for definitions and notation. +""" +from collections import Counter +from functools import cached_property + +from attrs import frozen + +from qualtran import ( + Bloq, + bloq_example, + BloqBuilder, + BloqDocSpec, + DecomposeTypeError, + QAny, + Signature, + Soquet, + SoquetT, +) +from qualtran.bloqs.block_encoding import BlockEncoding +from qualtran.bloqs.phase_estimation import KaiserWindowState, QubitizationQPE +from qualtran.bloqs.phase_estimation.qpe_window_state import QPEWindowStateBase +from qualtran.bloqs.reflections.prepare_identity import PrepareIdentity +from qualtran.bloqs.reflections.reflection_using_prepare import ReflectionUsingPrepare +from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare +from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator +from qualtran.symbolics import ceil, is_symbolic, is_zero, ln, log2, pi, SymbolicFloat, SymbolicInt + +from .walk_operator import QubitizedWalkOperator + + +@frozen +class GuidedHamiltonianPhaseEstimation(Bloq): + r"""Implement the phase estimation algorithm $U_\text{PE}$""" + + hamiltonian: BlockEncoding + guiding_state: BlackBoxPrepare + precision: SymbolicFloat + fail_prob: SymbolicFloat + + def __attrs_post_init__(self): + assert ( + self.hamiltonian.resource_bitsize == 0 + ), "block encoding with resource regs not supported" + + assert self.hamiltonian.system_bitsize == self.guiding_state.selection_bitsize + + @cached_property + def signature(self) -> 'Signature': + return Signature.build_from_dtypes( + phase_estimate=self.qpe_window_state.m_register.dtype, + system=QAny(self.hamiltonian.system_bitsize), + walk_ancilla=QAny(self.hamiltonian.ancilla_bitsize), + guide_ancilla=QAny(self.guiding_state.junk_bitsize), + ) + + @cached_property + def walk_operator(self) -> QubitizedWalkOperator: + return QubitizedWalkOperator(self.hamiltonian) + + @cached_property + def qpe_window_state(self) -> QPEWindowStateBase: + """Kaiser Window state. + Computes a slightly larger value for a simpler expression. + https://arxiv.org/abs/2209.13581, Eq D14, D15 + """ + eps, delta = self.precision, self.fail_prob + + alpha = ln(1 / delta) / pi(delta) + + N = (1 / eps) * ln(1 / delta) + m_bits = ceil(log2(N)) + return KaiserWindowState(bitsize=m_bits, alpha=alpha) + + @cached_property + def qpe_bloq(self) -> QubitizationQPE: + return QubitizationQPE(self.walk_operator, self.qpe_window_state) # type: ignore + + def build_composite_bloq( + self, + bb: 'BloqBuilder', + phase_estimate: Soquet, + system: Soquet, + walk_ancilla: Soquet, + **soqs: SoquetT, + ) -> dict[str, 'SoquetT']: + + # prepare the guiding state + if is_zero(self.guiding_state.junk_bitsize): + system = bb.add(self.guiding_state, selection=system) + else: + system, guide_ancilla = bb.add( + self.guiding_state, selection=system, junk=soqs.pop('guide_ancilla') + ) + soqs['guide_ancilla'] = guide_ancilla + + # apply QPE + phase_estimate, system, walk_ancilla = bb.add( + self.qpe_bloq, qpe_reg=phase_estimate, system=system, ancilla=walk_ancilla + ) + + return { + 'phase_estimate': phase_estimate, + 'system': system, + 'walk_ancilla': walk_ancilla, + } | soqs + + +@bloq_example +def _guided_phase_estimate_symb() -> GuidedHamiltonianPhaseEstimation: + import sympy + + from qualtran.bloqs.optimization.k_xor_sat import GuidingState, KikuchiHamiltonian, KXorInstance + from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare + from qualtran.symbolics import ceil, log2 + + n, k, c = sympy.symbols("n k c", positive=True, integer=True) + m_guide, m_solve = sympy.symbols("m_1 m_2", positive=True, integer=True) + + inst_guide = KXorInstance.symbolic(n, m_guide, k, max_rhs=2) + inst_solve = KXorInstance.symbolic(n, m_solve, k, max_rhs=2) + l = c * k + s = l * ceil(log2(n)) + + Psi = GuidingState(inst_guide, l) + H = KikuchiHamiltonian(inst_solve, c * k, s) + + eps, delta = sympy.symbols(r"\epsilon_{PE} \delta_{PE}", positive=True, real=True) + guided_phase_estimate_symb = GuidedHamiltonianPhaseEstimation( + H, BlackBoxPrepare(Psi), eps, delta + ) + + return guided_phase_estimate_symb + + +_GUIDED_HAMILTONIAN_PHASE_ESTIMATION_DOC = BloqDocSpec( + bloq_cls=GuidedHamiltonianPhaseEstimation, examples=[_guided_phase_estimate_symb] +) + + +@frozen +class GuidedHamiltonian(Bloq): + r"""Solve the guided (sparse) hamiltonian problem. + + Definition 4.8 (modified to accept any block-encoding): + In the Guided Hamiltonian problem we are given the following as input: + + 1. A $(\sqrt{2} s, \cdot, 0)$-block-encoding of a Hamiltonian $H$ such that $\|H\|_\max \le s$. + 2. A unitary program that prepares $|\Psi\rangle|0^A\rangle$. + 3. Parameters $\lambda \in [-\Lambda, \Lambda]$, $\alpha \in (0, 1)$, $\gamma \in (0, 1]$. + + and we should output + + - YES (1) if $\| \Pi_{\ge \lambda} (H) |\Psi\rangle \| \ge \gamma$ + - NO (0) if $\|H\| \le (1 - \alpha) \lambda$ + + Note that the above drops the sparse requirement, and accepts any + $(\alpha_H, \cdot, \cdot)$-block-encoding of $H$. + In the sparse Hamiltonian case, $\alpha_H = s$ (where $s$ is the sparsity). + + Algorithm (Theorem 4.9): + This uses phase estimation on the block-encoding of $e^{iHt}$, and then uses + amplitude amplification to increase the success probability to $1 - o(1)$. + + We instead directly do phase-estimation on the qubitized (Szegedy) walk operator for $H$ + + Args: + hamiltonian: the block-encoding of $H$ + guiding_state: the unitary that prepares $|\Psi\rangle$ + lambd: parameter $\lambda$ + alpha: parameter $\alpha$ + gamma: parameter $\gamma$ + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Section 4.2 "Guided Sparse Hamiltonian Problem". + """ + + hamiltonian: BlockEncoding + guiding_state: BlackBoxPrepare + lambd: SymbolicFloat + alpha: SymbolicFloat + gamma: SymbolicFloat + + def __attrs_post_init__(self): + assert self.hamiltonian.resource_bitsize == 0, "resource not supported" + assert ( + self.hamiltonian.system_bitsize == self.guiding_state.selection_bitsize + ), "system registers must match" + + assert self.signature == self.qpe_bloq.signature + + @cached_property + def signature(self) -> 'Signature': + return Signature.build_from_dtypes( + phase_estimate=self.qpe_bloq.qpe_window_state.m_register.dtype, + system=QAny(self.hamiltonian.system_bitsize), + walk_ancilla=QAny(self.hamiltonian.ancilla_bitsize), + guide_ancilla=QAny(self.guiding_state.junk_bitsize), + ) + + @cached_property + def qpe_precision(self) -> SymbolicFloat: + r"""The precision for phase estimation. + + Page 31, Eq 100 of the reference gives the precision value for estimating phases + of $e^{iHt}$ with $t = \pi/(2s)$. But this bloq does phase estimation directly + on the walk operator, with eigenphases $e^{-i \arccos(H/s)}$. + + To bound this, consider the two eigenvalues that are to be distinguished: + $\lambda$ and $(1 - \alpha)\lambda$. We can bound the difference in estimated phases as + + $$ + |\arccos(\lambda / s) - \arccos((1-\alpha)\lambda / s)| + \le \frac{\alpha \lambda}{s} \frac{1}{1 - ((1 - \alpha)\lambda / s)^2} + $$ + + As we know $\|H\| \le s/\sqrt{2}$, it means $\lambda/s \le 1/\sqrt{2}$, + therefore the second term is at most $\sqrt{2}$. + + In the sparse encoding case, we can increase the sparsity to $\sqrt{2} s$ + when block-encoding the input, to ensure that we have an epsilon bound of + $\alpha \lambda / s$. + """ + return self.alpha * self.lambd / self.hamiltonian.alpha + + @cached_property + def qpe_fail_prob(self) -> SymbolicFloat: + """Page 31, above Eq 104.""" + return self.gamma**3 + + @cached_property + def n_rounds_amplification(self) -> SymbolicInt: + return ceil(1 / self.gamma) + + @cached_property + def qpe_bloq(self) -> GuidedHamiltonianPhaseEstimation: + return GuidedHamiltonianPhaseEstimation( + hamiltonian=self.hamiltonian, + guiding_state=self.guiding_state, + precision=self.qpe_precision, + fail_prob=self.qpe_fail_prob, + ) + + @cached_property + def _refl_guide_ancilla(self) -> ReflectionUsingPrepare: + return ReflectionUsingPrepare.reflection_around_zero( + bitsizes=[self.guiding_state.junk_bitsize], global_phase=-1 + ) + + @cached_property + def _refl_all(self) -> ReflectionUsingPrepare: + return ReflectionUsingPrepare(PrepareIdentity(tuple(self.signature)), global_phase=-1) + + def build_composite_bloq(self, bb: 'BloqBuilder', **soqs: 'SoquetT') -> dict[str, 'SoquetT']: + if is_symbolic(self.n_rounds_amplification): + raise DecomposeTypeError( + f'cannot decompose {self} with symbolic number of rounds {self.n_rounds_amplification}' + ) + + soqs = bb.add_d(self.qpe_bloq, **soqs) + for _ in range(self.n_rounds_amplification): + ### reflect about bad state + soqs['guide_ancilla'] = bb.add(self._refl_guide_ancilla, reg0_=soqs['guide_ancilla']) + + ### reflect about prepared state + soqs = bb.add_d(self.qpe_bloq.adjoint(), **soqs) + soqs = bb.add_d(self._refl_all, **soqs) + soqs = bb.add_d(self.qpe_bloq, **soqs) + + return soqs + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: + counts = Counter[Bloq]() + + # prepare the initial state + counts[self.qpe_bloq] += 1 + + # reflect about the ancilla being all 0 + counts[self._refl_guide_ancilla] += self.n_rounds_amplification + + # reflect about the prepared state + counts[self.qpe_bloq.adjoint()] += self.n_rounds_amplification + counts[self._refl_all] += self.n_rounds_amplification + counts[self.qpe_bloq] += self.n_rounds_amplification + + return counts + + +@bloq_example +def _guided_hamiltonian() -> GuidedHamiltonian: + import sympy + + from qualtran.bloqs.optimization.k_xor_sat import GuidingState, KikuchiHamiltonian, KXorInstance + from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare + from qualtran.symbolics import ceil, log2 + + n, k, m, c = sympy.symbols("n k m c", positive=True, integer=True) + zeta = sympy.symbols(r"\zeta", positive=True) + + inst_guide = KXorInstance.symbolic(n, (1 - zeta) * m, k, max_rhs=2) + inst_solve = KXorInstance.symbolic(n, zeta * m, k, max_rhs=2) + l = c * k + s = l * ceil(log2(n)) + + Psi = GuidingState(inst_guide, l) + H = KikuchiHamiltonian(inst_solve, c * k, s) + + lambd, alpha, gamma = sympy.symbols(r"\lambda \alpha \gamma", positive=True, real=True) + guided_hamiltonian = GuidedHamiltonian(H, BlackBoxPrepare(Psi), lambd, alpha, gamma) + return guided_hamiltonian + + +_GUIDED_HAMILTONIAN_DOC = BloqDocSpec(bloq_cls=GuidedHamiltonian, examples=[_guided_hamiltonian]) diff --git a/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian_test.py b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian_test.py new file mode 100644 index 000000000..1ab6c5465 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/guided_hamiltonian_test.py @@ -0,0 +1,31 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import pytest + +from .guided_hamiltonian import _guided_hamiltonian, _guided_phase_estimate_symb + + +@pytest.mark.parametrize("bloq_ex", [_guided_hamiltonian, _guided_phase_estimate_symb]) +def test_examples(bloq_autotester, bloq_ex): + if bloq_autotester.check_name == 'serialize': + pytest.skip() + + bloq_autotester(bloq_ex) + + +@pytest.mark.notebook +def test_notebook(): + from qualtran.testing import execute_notebook + + execute_notebook('guided_hamiltonian') diff --git a/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/tutorial_guided_hamiltonian.ipynb b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/tutorial_guided_hamiltonian.ipynb new file mode 100644 index 000000000..fe31ae38e --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/tutorial_guided_hamiltonian.ipynb @@ -0,0 +1,2005 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "6d27900d7109a493", + "metadata": {}, + "source": [ + "# Guided (sparse) Hamiltonian Problem" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "ec7403af5f8f9302", + "metadata": { + "ExecuteTime": { + "end_time": "2024-08-27T18:07:47.146430Z", + "start_time": "2024-08-27T18:07:44.824865Z" + } + }, + "outputs": [], + "source": [ + "from attrs import frozen\n", + "import attrs\n", + "from qualtran import Bloq, Signature, Register, QAny\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", + "from qualtran.symbolics import SymbolicInt, ceil, log2, ln, is_symbolic\n", + "from qualtran.resource_counting import big_O\n", + "from qualtran.resource_counting.generalizers import ignore_alloc_free, ignore_split_join, ignore_cliffords\n", + "from qualtran.bloqs.block_encoding import BlockEncoding\n", + "from qualtran.bloqs.reflections.reflection_using_prepare import ReflectionUsingPrepare\n", + "from qualtran.bloqs.max_k_xor_sat.guided_hamiltonian import GuidedHamiltonian\n", + "from qualtran.bloqs.max_k_xor_sat.shims import ArbitraryGate # arbitrary 1/2-qubit gate, for costing." + ] + }, + { + "cell_type": "markdown", + "id": "fd4d302a-8cfe-48b5-8e44-a9b99a0b5e5b", + "metadata": {}, + "source": [ + "## `GuidedHamiltonian`\n", + "Solve the guided (sparse) hamiltonian problem.\n", + "\n", + "Definition 4.8 (modified with sparsity generalized to any):\n", + "In the Guided Hamiltonian problem we are given the following as input:\n", + "\n", + "1. A Hamiltonian $H$ with $\\|H\\|_\\max \\le 1$, specified via a block-encoding.\n", + "2. A unitary program that takes $|0^N\\rangle|0^A\\rangle$ and prepares $|\\Psi\\rangle|0^A\\rangle$.\n", + "3. Parameters $\\lambda \\in [-\\Lambda, \\Lambda]$, $\\alpha \\in (0, 1)$, $\\gamma \\in (0, 1]$.\n", + "\n", + "and we should output\n", + "\n", + "- YES if $\\| \\Pi_{\\ge \\lambda} (H) |\\Psi\\rangle \\| \\ge \\gamma$\n", + "- NO if $\\|H\\| \\le (1 - \\alpha) \\lambda$\n", + "\n", + "Note that the above drops the sparse requirement, and accepts any\n", + "$(\\alpha_H, \\cdot, \\cdot)$-block-encoding of $H$.\n", + "In the sparse Hamiltonian case, $\\alpha_H = s$ (where $s$ is the sparsity).\n", + "\n", + "Algorithm (Theorem 4.9):\n", + " This uses phase estimation on the block-encoding of $e^{iHt}$, and then uses\n", + " amplitude amplification to increase the success probability to $1 - o(1)$.\n", + "\n", + "We instead directly do phase-estimation on the qubitized (Szegedy) walk operator for $H$.\n", + "\n", + "#### Parameters\n", + " - `hamiltonian`: the block-encoding of $H$\n", + " - `guiding_state`: the unitary that prepares $|\\Psi\\rangle$\n", + " - `lambd`: parameter $\\lambda$\n", + " - `alpha`: parameter $\\alpha$\n", + " - `gamma`: parameter $\\gamma$ " + ] + }, + { + "cell_type": "markdown", + "id": "06cdbc3b-b4bd-47da-84ba-cd7b0059bb6f", + "metadata": {}, + "source": [ + "# Computing Query Costs with Qualtran\n", + "\n", + "We will first create black-boxes for a Hamiltonian and a guiding state preparation, that can be passed to the `GuidedHamiltonian` bloq to count number of queries and gates." + ] + }, + { + "cell_type": "markdown", + "id": "fb7db14a-d5d1-4f02-b082-43ada6fa1aee", + "metadata": {}, + "source": [ + "## Building black-box oracles" + ] + }, + { + "cell_type": "markdown", + "id": "b50f74cc-e8dc-4214-a020-af0e80ef5469", + "metadata": {}, + "source": [ + "### Graph oracles for the Hamiltonian\n", + "We first build the oracles $O_F$ and $O_H$, and use them to block-encode a sparse matrix." + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "4a490bf8-e83f-497a-a422-2e1eb2444e70", + "metadata": {}, + "outputs": [], + "source": [ + "@frozen\n", + "class oracle_O_H(Bloq):\n", + " \"\"\"given (i, j), output H_{i, j}\"\"\"\n", + " N: SymbolicInt\n", + " entry_bits: SymbolicInt\n", + " \n", + " @property\n", + " def signature(self):\n", + " return Signature.build(i=self.N, j=self.N, entry=self.entry_bits)\n", + "\n", + " def adjoint(self):\n", + " return self\n", + "\n", + "@frozen\n", + "class oracle_O_F(Bloq):\n", + " \"\"\"Given (i, k), output (i, f(i, k)) s.t. f(i, k) is the k-th non zero entry in row i\"\"\"\n", + " N: SymbolicInt\n", + " reverse: bool = False\n", + " \n", + " @property\n", + " def signature(self):\n", + " return Signature.build(i=self.N, k=self.N)\n", + "\n", + " def adjoint(self):\n", + " return oracle_O_F(self.N, reverse=not self.reverse)\n", + "\n", + "\n", + "@frozen\n", + "class EncodeSparseHamiltonian(BlockEncoding):\n", + " \"\"\"(s, N+1, 0)-block-encoding of s-sparse NxN matrix H\"\"\"\n", + " N: SymbolicInt\n", + " s: SymbolicInt # sparsity\n", + " O_F: oracle_O_F\n", + " O_H: oracle_O_H\n", + "\n", + " @property\n", + " def signature(self) -> Signature:\n", + " return Signature.build_from_dtypes(\n", + " system=QAny(self.system_bitsize),\n", + " ancilla=QAny(self.ancilla_bitsize),\n", + " )\n", + "\n", + " @property\n", + " def system_bitsize(self):\n", + " return self.N\n", + "\n", + " @property\n", + " def ancilla_bitsize(self):\n", + " return self.N + 1\n", + "\n", + " @property\n", + " def resource_bitsize(self):\n", + " return 0\n", + "\n", + " @property\n", + " def alpha(self):\n", + " return self.s\n", + "\n", + " @property\n", + " def epsilon(self):\n", + " return 0\n", + "\n", + " @property\n", + " def signal_state(self):\n", + " from qualtran.bloqs.reflections.prepare_identity import PrepareIdentity\n", + " from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare\n", + " \n", + " return BlackBoxPrepare(PrepareIdentity.from_bitsizes([self.ancilla_bitsize]))\n", + "\n", + " def build_call_graph(self, ssa):\n", + " \"\"\"\n", + " References:\n", + " [Lecture Notes on Quantum Algorithms for Scientific Computation](https://arxiv.org/abs/2201.08309). Lin Lin (2022). Ch. 6.5.\n", + " \"\"\"\n", + " log_s = ceil(log2(self.s))\n", + " return {(self.O_F, 2), (self.O_H, 2), (ArbitraryGate(), 2*log_s)}" + ] + }, + { + "cell_type": "markdown", + "id": "60df1af0-0a6f-4645-8739-b75f4ece3553", + "metadata": {}, + "source": [ + "### State-preparation Oracle for the guiding state\n", + "\n", + "Point 2. Quantum circuit that uses $G$ gates and maps $|0^N\\rangle|0^A\\rangle$ to $|\\Psi\\rangle|0^A\\rangle$" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0a17eab5-0a44-4526-9b08-483086c655bf", + "metadata": {}, + "outputs": [], + "source": [ + "@frozen\n", + "class GuidingState(Bloq):\n", + " \"\"\"Point 2. Quantum circuit that uses G gates and maps |0^N>|0^A> to |\\Psi>|0^A>\"\"\"\n", + " N: SymbolicInt\n", + " A: SymbolicInt\n", + " G: SymbolicInt\n", + " \n", + " @property\n", + " def signature(self) -> Bloq:\n", + " return Signature.build(selection=self.N, junk=self.A)\n", + "\n", + " def build_call_graph(self, ssa):\n", + " return {(ArbitraryGate(), self.G)}\n", + " \n", + " @property\n", + " def selection_bitsize(self):\n", + " return self.N\n", + " @property\n", + " def junk_bitsize(self):\n", + " return self.A\n", + " @property\n", + " def selection_registers(self):\n", + " return (Register('selection', QAny(self.N)),)\n", + " @property\n", + " def junk_registers(self):\n", + " return (Register('junk', QAny(self.A)),)" + ] + }, + { + "cell_type": "markdown", + "id": "f127675c-6616-43eb-b33a-479ae146dcfa", + "metadata": {}, + "source": [ + "## An example invocation\n", + "With these oracles in place, we can now invoke the `GuidedHamiltonian` algorithm." + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "32219420-f41b-4c80-b89b-2076795d596f", + "metadata": {}, + "outputs": [], + "source": [ + "import sympy\n", + "\n", + "def example_bloq() -> GuidedHamiltonian:\n", + " N, A, G, s = sympy.symbols(\"N A G s\", positive=True, integer=True)\n", + " lambd, alpha, gamma = sympy.symbols(r\"\\lambda \\alpha \\gamma\", positive=True, real=True)\n", + "\n", + " O_F = oracle_O_F(N)\n", + " O_H = oracle_O_H(N, 10)\n", + " be_H = EncodeSparseHamiltonian(N, s, O_F, O_H)\n", + " psi = GuidingState(N, A, G)\n", + "\n", + " return GuidedHamiltonian(be_H, psi, lambd, alpha, gamma)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "13b8eb29-1af9-4d65-a954-cf96498efad1", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"453pt\" height=\"206pt\" viewBox=\"0.00 0.00 453.00 206.00\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 202)\">\n", + "<title>my_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-202 449,-202 449,4 -4,4\"/>\n", + "<!-- phase_estimate_G9 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>phase_estimate_G9</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-175.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- GuidedHamiltonian -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>GuidedHamiltonian</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-145 164,-163 281,-163 281,-145 164,-145\"/>\n", + "<text text-anchor=\"start\" x=\"172.25\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidedHamiltonian</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-122 164,-145 281,-145 281,-122 164,-122\"/>\n", + "<text text-anchor=\"start\" x=\"167\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-99 164,-122 281,-122 281,-99 164,-99\"/>\n", + "<text text-anchor=\"start\" x=\"197\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-76 164,-99 281,-99 281,-76 164,-76\"/>\n", + "<text text-anchor=\"start\" x=\"179.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-53 164,-76 281,-76 281,-53 164,-53\"/>\n", + "<text text-anchor=\"start\" x=\"176\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- phase_estimate_G9->GuidedHamiltonian -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>phase_estimate_G9:e->GuidedHamiltonian:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M127,-180C152.38,-180 138.76,-137.06 161.09,-133.71\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-133.61\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-161.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G11 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>system_G11</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-121.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- system_G11->GuidedHamiltonian -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>system_G11:e->GuidedHamiltonian:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M97.97,-126C127.17,-126 133.47,-111.45 161.24,-110.54\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-110.52\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-115.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla_G0 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>walk_ancilla_G0</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- walk_ancilla_G0->GuidedHamiltonian -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>walk_ancilla_G0:e->GuidedHamiltonian:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M115.58,-72C137.29,-72 141.12,-86.31 161.44,-87.43\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-87.46\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-85.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- guide_ancilla_G8 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>guide_ancilla_G8</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- guide_ancilla_G8->GuidedHamiltonian -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>guide_ancilla_G8:e->GuidedHamiltonian:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M118.95,-18C146.71,-18 136.05,-61.29 161.11,-64.33\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-64.41\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-55.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- phase_estimate_G2 -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>phase_estimate_G2</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-175.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- GuidedHamiltonian->phase_estimate_G2 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>GuidedHamiltonian:e->phase_estimate_G2:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-133.5C306.38,-133.5 292.76,-176.44 315.09,-179.79\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"316.5\" cy=\"-179.89\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-161.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G7 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>system_G7</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-121.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- GuidedHamiltonian->system_G7 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>GuidedHamiltonian:e->system_G7:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-110.5C310.2,-110.5 316.5,-125.05 344.28,-125.96\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"345.53\" cy=\"-125.98\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-115.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla_G3 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>walk_ancilla_G3</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonian->walk_ancilla_G3 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>GuidedHamiltonian:e->walk_ancilla_G3:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-87.5C302.71,-87.5 306.54,-73.19 326.86,-72.07\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"327.92\" cy=\"-72.04\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-85.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- guide_ancilla_G4 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>guide_ancilla_G4</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonian->guide_ancilla_G4 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>GuidedHamiltonian:e->guide_ancilla_G4:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-64.5C308.76,-64.5 298.1,-21.21 323.17,-18.17\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"324.55\" cy=\"-18.09\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-55.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "</g>\n", + "</svg>" + ], + "text/plain": [ + "<IPython.core.display.SVG object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "bloq = example_bloq()\n", + "show_bloq(bloq)" + ] + }, + { + "cell_type": "markdown", + "id": "ac277b8a-8ae9-47cc-bd46-7f23c56d1392", + "metadata": {}, + "source": [ + "## Circuit Diagrams\n", + "\n", + "We will now look at the decomposition of the bloq, to see the steps of the algorithm.\n", + "First we look at the phase estimation bloq $U_\\text{PE}$.\n", + "To obtain the entire algorithm, we use amplitude-amplification on $U_\\text{PE}$ for $O(1/\\gamma)$ rounds.\n", + "The good subspace is characterized by `guide_ancilla` being all 0." + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "9d2c34d3-9a19-4d54-a60a-549c590533e7", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"536pt\" height=\"244pt\" viewBox=\"0.00 0.00 536.00 244.00\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 240)\">\n", + "<title>my_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-240 532,-240 532,4 -4,4\"/>\n", + "<!-- phase_estimate_G8 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>phase_estimate_G8</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-182.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- QubitizationQPE -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>QubitizationQPE</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-198.5 274,-216.5 364,-216.5 364,-198.5 274,-198.5\"/>\n", + "<text text-anchor=\"start\" x=\"276.62\" y=\"-204\" font-family=\"Times,serif\" font-size=\"10.00\">QubitizationQPE</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-175.5 274,-198.5 364,-198.5 364,-175.5 274,-175.5\"/>\n", + "<text text-anchor=\"start\" x=\"290.5\" y=\"-182.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-152.5 274,-175.5 364,-175.5 364,-152.5 274,-152.5\"/>\n", + "<text text-anchor=\"start\" x=\"293.5\" y=\"-159.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-129.5 274,-152.5 364,-152.5 364,-129.5 274,-129.5\"/>\n", + "<text text-anchor=\"start\" x=\"295.75\" y=\"-136.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- phase_estimate_G8->QubitizationQPE -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>phase_estimate_G8:e->QubitizationQPE:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M127,-187C191.44,-187 208.21,-187 271.35,-187\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"272.5\" cy=\"-187\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"200.5\" y=\"-190.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G9 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>system_G9</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- GuidingState -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>GuidingState</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-78 164,-96 237,-96 237,-78 164,-78\"/>\n", + "<text text-anchor=\"start\" x=\"166.75\" y=\"-83.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidingState</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-55 164,-78 237,-78 237,-55 164,-55\"/>\n", + "<text text-anchor=\"start\" x=\"168.62\" y=\"-61.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-32 164,-55 237,-55 237,-32 164,-32\"/>\n", + "<text text-anchor=\"start\" x=\"185.12\" y=\"-38.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- system_G9->GuidingState -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>system_G9:e->GuidingState:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M97.97,-72C126.5,-72 134.08,-66.84 161.3,-66.52\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-66.51\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-70.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>walk_ancilla</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-127.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- walk_ancilla->QubitizationQPE -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>walk_ancilla:e->QubitizationQPE:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M115.58,-132C185.14,-132 202.99,-140.76 271.14,-140.99\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"272.5\" cy=\"-141\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"200.5\" y=\"-143.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- guide_ancilla_G7 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>guide_ancilla_G7</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- guide_ancilla_G7->GuidingState -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>guide_ancilla_G7:e->GuidingState:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M118.95,-18C141.06,-18 141.03,-41.55 161.41,-43.39\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-43.43\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-38.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- GuidingState->QubitizationQPE -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>GuidingState:e->QubitizationQPE:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M237,-66.5C282.44,-66.5 229.79,-160.23 271.4,-163.89\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"272.5\" cy=\"-163.94\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"255.5\" y=\"-152.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- guide_ancilla -->\n", + "<g id=\"node10\" class=\"node\">\n", + "<title>guide_ancilla</title>\n", + "<text text-anchor=\"middle\" x=\"464.5\" y=\"-39.33\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidingState->guide_ancilla -->\n", + "<g id=\"edge9\" class=\"edge\">\n", + "<title>GuidingState:e->guide_ancilla:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M237,-43.5C312.57,-43.5 332.13,-43.99 406.39,-44\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"407.55\" cy=\"-44\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"319\" y=\"-46.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- phase_estimate -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>phase_estimate</title>\n", + "<text text-anchor=\"middle\" x=\"464.5\" y=\"-213.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- QubitizationQPE->phase_estimate -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>QubitizationQPE:e->phase_estimate:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M364,-187C384.45,-187 380.04,-215.16 398.16,-217.8\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"399.5\" cy=\"-217.9\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"382.5\" y=\"-206.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G3 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>system_G3</title>\n", + "<text text-anchor=\"middle\" x=\"464.5\" y=\"-159.32\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- QubitizationQPE->system_G3 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>QubitizationQPE:e->system_G3:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M364,-164C392.43,-164 400.2,-164 427.34,-164\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"428.53\" cy=\"-164\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"382.5\" y=\"-167.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla_G1 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>walk_ancilla_G1</title>\n", + "<text text-anchor=\"middle\" x=\"464.5\" y=\"-105.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- QubitizationQPE->walk_ancilla_G1 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>QubitizationQPE:e->walk_ancilla_G1:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M364,-141C388.56,-141 387.04,-112.37 409.55,-110.14\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"410.93\" cy=\"-110.07\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"382.5\" y=\"-135.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "</g>\n", + "</svg>" + ], + "text/plain": [ + "<IPython.core.display.SVG object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_bloq(bloq.qpe_bloq.decompose_bloq())" + ] + }, + { + "cell_type": "markdown", + "id": "08002b28-5d5f-4283-add6-d4fd914a0112", + "metadata": {}, + "source": [ + "### Full Circuit\n", + "For exposition, let us pick the number of rounds as a constant (say, $3$) to see the decomposition:" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "46e5a6af-4270-49fd-af5a-ae066503e378", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"3051pt\" height=\"206pt\" viewBox=\"0.00 0.00 3051.00 206.00\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 202)\">\n", + "<title>my_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-202 3047,-202 3047,4 -4,4\"/>\n", + "<!-- phase_estimate_G52 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>phase_estimate_G52</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-175.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G18 -->\n", + "<g id=\"node10\" class=\"node\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G18</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-145 164,-163 356,-163 356,-145 164,-145\"/>\n", + "<text text-anchor=\"start\" x=\"167\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidedHamiltonianPhaseEstimation</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-122 164,-145 356,-145 356,-122 164,-122\"/>\n", + "<text text-anchor=\"start\" x=\"204.5\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-99 164,-122 356,-122 356,-99 164,-99\"/>\n", + "<text text-anchor=\"start\" x=\"234.5\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-76 164,-99 356,-99 356,-76 164,-76\"/>\n", + "<text text-anchor=\"start\" x=\"216.88\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-53 164,-76 356,-76 356,-53 164,-53\"/>\n", + "<text text-anchor=\"start\" x=\"213.5\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- phase_estimate_G52->GuidedHamiltonianPhaseEstimation_G18 -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>phase_estimate_G52:e->GuidedHamiltonianPhaseEstimation_G18:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M127,-180C152.38,-180 138.76,-137.06 161.09,-133.71\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-133.61\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-161.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G97 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>system_G97</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-121.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- system_G97->GuidedHamiltonianPhaseEstimation_G18 -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>system_G97:e->GuidedHamiltonianPhaseEstimation_G18:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M97.97,-126C127.17,-126 133.47,-111.45 161.24,-110.54\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-110.52\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-115.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla_G88 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>walk_ancilla_G88</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- walk_ancilla_G88->GuidedHamiltonianPhaseEstimation_G18 -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>walk_ancilla_G88:e->GuidedHamiltonianPhaseEstimation_G18:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M115.58,-72C137.29,-72 141.12,-86.31 161.44,-87.43\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-87.46\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-85.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- guide_ancilla_G74 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>guide_ancilla_G74</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- guide_ancilla_G74->GuidedHamiltonianPhaseEstimation_G18 -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>guide_ancilla_G74:e->GuidedHamiltonianPhaseEstimation_G18:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M118.95,-18C146.71,-18 136.05,-61.29 161.11,-64.33\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-64.41\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-55.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- Adjoint -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>Adjoint</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2211,-145 2211,-163 2496,-163 2496,-145 2211,-145\"/>\n", + "<text text-anchor=\"start\" x=\"2213.62\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=GuidedHamiltonianPhaseEstimation)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2211,-122 2211,-145 2496,-145 2496,-122 2211,-122\"/>\n", + "<text text-anchor=\"start\" x=\"2298\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2211,-99 2211,-122 2496,-122 2496,-99 2211,-99\"/>\n", + "<text text-anchor=\"start\" x=\"2328\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2211,-76 2211,-99 2496,-99 2496,-76 2211,-76\"/>\n", + "<text text-anchor=\"start\" x=\"2310.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2211,-53 2211,-76 2496,-76 2496,-53 2211,-53\"/>\n", + "<text text-anchor=\"start\" x=\"2307\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- ReflectAboutZero -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>ReflectAboutZero</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2533,-145 2533,-163 2650,-163 2650,-145 2533,-145\"/>\n", + "<text text-anchor=\"start\" x=\"2546.88\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2533,-122 2533,-145 2650,-145 2650,-122 2533,-122\"/>\n", + "<text text-anchor=\"start\" x=\"2536\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2533,-99 2533,-122 2650,-122 2650,-99 2533,-99\"/>\n", + "<text text-anchor=\"start\" x=\"2566\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2533,-76 2533,-99 2650,-99 2650,-76 2533,-76\"/>\n", + "<text text-anchor=\"start\" x=\"2548.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2533,-53 2533,-76 2650,-76 2650,-53 2533,-53\"/>\n", + "<text text-anchor=\"start\" x=\"2545\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- Adjoint->ReflectAboutZero -->\n", + "<g id=\"edge36\" class=\"edge\">\n", + "<title>Adjoint:e->ReflectAboutZero:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2496,-133.5C2511.42,-133.5 2515.99,-133.5 2530.06,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2531.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2514.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- Adjoint->ReflectAboutZero -->\n", + "<g id=\"edge37\" class=\"edge\">\n", + "<title>Adjoint:e->ReflectAboutZero:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2496,-110.5C2511.42,-110.5 2515.99,-110.5 2530.06,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2531.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2514.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint->ReflectAboutZero -->\n", + "<g id=\"edge38\" class=\"edge\">\n", + "<title>Adjoint:e->ReflectAboutZero:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2496,-87.5C2511.42,-87.5 2515.99,-87.5 2530.06,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2531.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2514.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- Adjoint->ReflectAboutZero -->\n", + "<g id=\"edge39\" class=\"edge\">\n", + "<title>Adjoint:e->ReflectAboutZero:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2496,-64.5C2511.42,-64.5 2515.99,-64.5 2530.06,-64.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2531.5\" cy=\"-64.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2514.5\" y=\"-67.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>GuidedHamiltonianPhaseEstimation</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1846,-145 1846,-163 2038,-163 2038,-145 1846,-145\"/>\n", + "<text text-anchor=\"start\" x=\"1849\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidedHamiltonianPhaseEstimation</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1846,-122 1846,-145 2038,-145 2038,-122 1846,-122\"/>\n", + "<text text-anchor=\"start\" x=\"1886.5\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1846,-99 1846,-122 2038,-122 2038,-99 1846,-99\"/>\n", + "<text text-anchor=\"start\" x=\"1916.5\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1846,-76 1846,-99 2038,-99 2038,-76 1846,-76\"/>\n", + "<text text-anchor=\"start\" x=\"1898.88\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1846,-53 1846,-76 2038,-76 2038,-53 1846,-53\"/>\n", + "<text text-anchor=\"start\" x=\"1895.5\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation->Adjoint -->\n", + "<g id=\"edge32\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation:e->Adjoint:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2038,-133.5C2113.99,-133.5 2133.65,-133.5 2208.32,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2209.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2124.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation->Adjoint -->\n", + "<g id=\"edge33\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation:e->Adjoint:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2038,-110.5C2113.99,-110.5 2133.65,-110.5 2208.32,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2209.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2124.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation->Adjoint -->\n", + "<g id=\"edge34\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation:e->Adjoint:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2038,-87.5C2113.99,-87.5 2133.65,-87.5 2208.32,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2209.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2124.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G23 -->\n", + "<g id=\"node11\" class=\"node\">\n", + "<title>ReflectAboutZero_G23</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2075,-26.5 2075,-44.5 2174,-44.5 2174,-26.5 2075,-26.5\"/>\n", + "<text text-anchor=\"start\" x=\"2079.88\" y=\"-32\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2075,-3.5 2075,-26.5 2174,-26.5 2174,-3.5 2075,-3.5\"/>\n", + "<text text-anchor=\"start\" x=\"2078\" y=\"-10.2\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation->ReflectAboutZero_G23 -->\n", + "<g id=\"edge31\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation:e->ReflectAboutZero_G23:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2038,-64.5C2064.5,-64.5 2048.74,-18.42 2072.27,-15.18\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2073.5\" cy=\"-15.1\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2056.5\" y=\"-44.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G4 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G4</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1005,-145 1005,-163 1197,-163 1197,-145 1005,-145\"/>\n", + "<text text-anchor=\"start\" x=\"1008\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidedHamiltonianPhaseEstimation</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1005,-122 1005,-145 1197,-145 1197,-122 1005,-122\"/>\n", + "<text text-anchor=\"start\" x=\"1045.5\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1005,-99 1005,-122 1197,-122 1197,-99 1005,-99\"/>\n", + "<text text-anchor=\"start\" x=\"1075.5\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1005,-76 1005,-99 1197,-99 1197,-76 1005,-76\"/>\n", + "<text text-anchor=\"start\" x=\"1057.88\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1005,-53 1005,-76 1197,-76 1197,-53 1005,-53\"/>\n", + "<text text-anchor=\"start\" x=\"1054.5\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- Adjoint_G9 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>Adjoint_G9</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1370,-145 1370,-163 1655,-163 1655,-145 1370,-145\"/>\n", + "<text text-anchor=\"start\" x=\"1372.62\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=GuidedHamiltonianPhaseEstimation)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1370,-122 1370,-145 1655,-145 1655,-122 1370,-122\"/>\n", + "<text text-anchor=\"start\" x=\"1457\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1370,-99 1370,-122 1655,-122 1655,-99 1370,-99\"/>\n", + "<text text-anchor=\"start\" x=\"1487\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1370,-76 1370,-99 1655,-99 1655,-76 1370,-76\"/>\n", + "<text text-anchor=\"start\" x=\"1469.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1370,-53 1370,-76 1655,-76 1655,-53 1370,-53\"/>\n", + "<text text-anchor=\"start\" x=\"1466\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G4->Adjoint_G9 -->\n", + "<g id=\"edge19\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G4:e->Adjoint_G9:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1197,-133.5C1272.99,-133.5 1292.65,-133.5 1367.32,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1368.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1283.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G4->Adjoint_G9 -->\n", + "<g id=\"edge20\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G4:e->Adjoint_G9:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1197,-110.5C1272.99,-110.5 1292.65,-110.5 1367.32,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1368.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1283.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G4->Adjoint_G9 -->\n", + "<g id=\"edge21\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G4:e->Adjoint_G9:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1197,-87.5C1272.99,-87.5 1292.65,-87.5 1367.32,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1368.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1283.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G25 -->\n", + "<g id=\"node12\" class=\"node\">\n", + "<title>ReflectAboutZero_G25</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1234,-25.5 1234,-43.5 1333,-43.5 1333,-25.5 1234,-25.5\"/>\n", + "<text text-anchor=\"start\" x=\"1238.88\" y=\"-31\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1234,-2.5 1234,-25.5 1333,-25.5 1333,-2.5 1234,-2.5\"/>\n", + "<text text-anchor=\"start\" x=\"1237\" y=\"-9.2\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G4->ReflectAboutZero_G25 -->\n", + "<g id=\"edge18\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G4:e->ReflectAboutZero_G25:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1197,-64.5C1223.85,-64.5 1207.43,-17.49 1231.23,-14.18\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1232.5\" cy=\"-14.1\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1215.5\" y=\"-43.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G32 -->\n", + "<g id=\"node14\" class=\"node\">\n", + "<title>ReflectAboutZero_G32</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1692,-145 1692,-163 1809,-163 1809,-145 1692,-145\"/>\n", + "<text text-anchor=\"start\" x=\"1705.88\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1692,-122 1692,-145 1809,-145 1809,-122 1692,-122\"/>\n", + "<text text-anchor=\"start\" x=\"1695\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1692,-99 1692,-122 1809,-122 1809,-99 1692,-99\"/>\n", + "<text text-anchor=\"start\" x=\"1725\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1692,-76 1692,-99 1809,-99 1809,-76 1692,-76\"/>\n", + "<text text-anchor=\"start\" x=\"1707.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1692,-53 1692,-76 1809,-76 1809,-53 1692,-53\"/>\n", + "<text text-anchor=\"start\" x=\"1704\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- Adjoint_G9->ReflectAboutZero_G32 -->\n", + "<g id=\"edge23\" class=\"edge\">\n", + "<title>Adjoint_G9:e->ReflectAboutZero_G32:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1655,-133.5C1670.42,-133.5 1674.99,-133.5 1689.06,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1690.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1673.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- Adjoint_G9->ReflectAboutZero_G32 -->\n", + "<g id=\"edge24\" class=\"edge\">\n", + "<title>Adjoint_G9:e->ReflectAboutZero_G32:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1655,-110.5C1670.42,-110.5 1674.99,-110.5 1689.06,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1690.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1673.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G9->ReflectAboutZero_G32 -->\n", + "<g id=\"edge25\" class=\"edge\">\n", + "<title>Adjoint_G9:e->ReflectAboutZero_G32:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1655,-87.5C1670.42,-87.5 1674.99,-87.5 1689.06,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1690.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1673.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- Adjoint_G9->ReflectAboutZero_G32 -->\n", + "<g id=\"edge26\" class=\"edge\">\n", + "<title>Adjoint_G9:e->ReflectAboutZero_G32:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1655,-64.5C1670.42,-64.5 1674.99,-64.5 1689.06,-64.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1690.5\" cy=\"-64.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1673.5\" y=\"-67.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G37 -->\n", + "<g id=\"node15\" class=\"node\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G37</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2687,-145 2687,-163 2879,-163 2879,-145 2687,-145\"/>\n", + "<text text-anchor=\"start\" x=\"2690\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidedHamiltonianPhaseEstimation</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2687,-122 2687,-145 2879,-145 2879,-122 2687,-122\"/>\n", + "<text text-anchor=\"start\" x=\"2727.5\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2687,-99 2687,-122 2879,-122 2879,-99 2687,-99\"/>\n", + "<text text-anchor=\"start\" x=\"2757.5\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2687,-76 2687,-99 2879,-99 2879,-76 2687,-76\"/>\n", + "<text text-anchor=\"start\" x=\"2739.88\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2687,-53 2687,-76 2879,-76 2879,-53 2687,-53\"/>\n", + "<text text-anchor=\"start\" x=\"2736.5\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- ReflectAboutZero->GuidedHamiltonianPhaseEstimation_G37 -->\n", + "<g id=\"edge40\" class=\"edge\">\n", + "<title>ReflectAboutZero:e->GuidedHamiltonianPhaseEstimation_G37:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2650,-133.5C2665.42,-133.5 2669.99,-133.5 2684.06,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2685.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2668.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- ReflectAboutZero->GuidedHamiltonianPhaseEstimation_G37 -->\n", + "<g id=\"edge41\" class=\"edge\">\n", + "<title>ReflectAboutZero:e->GuidedHamiltonianPhaseEstimation_G37:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2650,-110.5C2665.42,-110.5 2669.99,-110.5 2684.06,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2685.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2668.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero->GuidedHamiltonianPhaseEstimation_G37 -->\n", + "<g id=\"edge42\" class=\"edge\">\n", + "<title>ReflectAboutZero:e->GuidedHamiltonianPhaseEstimation_G37:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2650,-87.5C2665.42,-87.5 2669.99,-87.5 2684.06,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2685.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2668.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero->GuidedHamiltonianPhaseEstimation_G37 -->\n", + "<g id=\"edge43\" class=\"edge\">\n", + "<title>ReflectAboutZero:e->GuidedHamiltonianPhaseEstimation_G37:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2650,-64.5C2665.42,-64.5 2669.99,-64.5 2684.06,-64.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2685.5\" cy=\"-64.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2668.5\" y=\"-67.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- Adjoint_G27 -->\n", + "<g id=\"node13\" class=\"node\">\n", + "<title>Adjoint_G27</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"529,-145 529,-163 814,-163 814,-145 529,-145\"/>\n", + "<text text-anchor=\"start\" x=\"531.62\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=GuidedHamiltonianPhaseEstimation)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"529,-122 529,-145 814,-145 814,-122 529,-122\"/>\n", + "<text text-anchor=\"start\" x=\"616\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"529,-99 529,-122 814,-122 814,-99 529,-99\"/>\n", + "<text text-anchor=\"start\" x=\"646\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"529,-76 529,-99 814,-99 814,-76 529,-76\"/>\n", + "<text text-anchor=\"start\" x=\"628.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"529,-53 529,-76 814,-76 814,-53 529,-53\"/>\n", + "<text text-anchor=\"start\" x=\"625\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G18->Adjoint_G27 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G18:e->Adjoint_G27:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M356,-133.5C431.99,-133.5 451.65,-133.5 526.32,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"527.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"442.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G18->Adjoint_G27 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G18:e->Adjoint_G27:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M356,-110.5C431.99,-110.5 451.65,-110.5 526.32,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"527.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"442.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G18->Adjoint_G27 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G18:e->Adjoint_G27:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M356,-87.5C431.99,-87.5 451.65,-87.5 526.32,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"527.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"442.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G42 -->\n", + "<g id=\"node16\" class=\"node\">\n", + "<title>ReflectAboutZero_G42</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"393,-25.5 393,-43.5 492,-43.5 492,-25.5 393,-25.5\"/>\n", + "<text text-anchor=\"start\" x=\"397.88\" y=\"-31\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"393,-2.5 393,-25.5 492,-25.5 492,-2.5 393,-2.5\"/>\n", + "<text text-anchor=\"start\" x=\"396\" y=\"-9.2\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G18->ReflectAboutZero_G42 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G18:e->ReflectAboutZero_G42:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M356,-64.5C382.85,-64.5 366.43,-17.49 390.23,-14.18\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"391.5\" cy=\"-14.1\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"374.5\" y=\"-43.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G23->Adjoint -->\n", + "<g id=\"edge35\" class=\"edge\">\n", + "<title>ReflectAboutZero_G23:e->Adjoint:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2174,-15C2200.5,-15 2184.74,-61.08 2208.27,-64.32\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2209.5\" cy=\"-64.4\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2192.5\" y=\"-44.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G25->Adjoint_G9 -->\n", + "<g id=\"edge22\" class=\"edge\">\n", + "<title>ReflectAboutZero_G25:e->Adjoint_G9:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1333,-14C1359.85,-14 1343.43,-61.01 1367.23,-64.32\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1368.5\" cy=\"-64.4\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1351.5\" y=\"-43.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G44 -->\n", + "<g id=\"node17\" class=\"node\">\n", + "<title>ReflectAboutZero_G44</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"851,-145 851,-163 968,-163 968,-145 851,-145\"/>\n", + "<text text-anchor=\"start\" x=\"864.88\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"851,-122 851,-145 968,-145 968,-122 851,-122\"/>\n", + "<text text-anchor=\"start\" x=\"854\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"851,-99 851,-122 968,-122 968,-99 851,-99\"/>\n", + "<text text-anchor=\"start\" x=\"884\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"851,-76 851,-99 968,-99 968,-76 851,-76\"/>\n", + "<text text-anchor=\"start\" x=\"866.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"851,-53 851,-76 968,-76 968,-53 851,-53\"/>\n", + "<text text-anchor=\"start\" x=\"863\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- Adjoint_G27->ReflectAboutZero_G44 -->\n", + "<g id=\"edge10\" class=\"edge\">\n", + "<title>Adjoint_G27:e->ReflectAboutZero_G44:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M814,-133.5C829.42,-133.5 833.99,-133.5 848.06,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"849.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"832.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- Adjoint_G27->ReflectAboutZero_G44 -->\n", + "<g id=\"edge11\" class=\"edge\">\n", + "<title>Adjoint_G27:e->ReflectAboutZero_G44:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M814,-110.5C829.42,-110.5 833.99,-110.5 848.06,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"849.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"832.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G27->ReflectAboutZero_G44 -->\n", + "<g id=\"edge12\" class=\"edge\">\n", + "<title>Adjoint_G27:e->ReflectAboutZero_G44:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M814,-87.5C829.42,-87.5 833.99,-87.5 848.06,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"849.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"832.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- Adjoint_G27->ReflectAboutZero_G44 -->\n", + "<g id=\"edge13\" class=\"edge\">\n", + "<title>Adjoint_G27:e->ReflectAboutZero_G44:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M814,-64.5C829.42,-64.5 833.99,-64.5 848.06,-64.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"849.5\" cy=\"-64.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"832.5\" y=\"-67.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G32->GuidedHamiltonianPhaseEstimation -->\n", + "<g id=\"edge27\" class=\"edge\">\n", + "<title>ReflectAboutZero_G32:e->GuidedHamiltonianPhaseEstimation:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1809,-133.5C1824.42,-133.5 1828.99,-133.5 1843.06,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1844.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1827.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G32->GuidedHamiltonianPhaseEstimation -->\n", + "<g id=\"edge28\" class=\"edge\">\n", + "<title>ReflectAboutZero_G32:e->GuidedHamiltonianPhaseEstimation:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1809,-110.5C1824.42,-110.5 1828.99,-110.5 1843.06,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1844.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1827.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G32->GuidedHamiltonianPhaseEstimation -->\n", + "<g id=\"edge29\" class=\"edge\">\n", + "<title>ReflectAboutZero_G32:e->GuidedHamiltonianPhaseEstimation:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1809,-87.5C1824.42,-87.5 1828.99,-87.5 1843.06,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1844.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1827.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G32->GuidedHamiltonianPhaseEstimation -->\n", + "<g id=\"edge30\" class=\"edge\">\n", + "<title>ReflectAboutZero_G32:e->GuidedHamiltonianPhaseEstimation:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1809,-64.5C1824.42,-64.5 1828.99,-64.5 1843.06,-64.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1844.5\" cy=\"-64.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1827.5\" y=\"-67.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- phase_estimate_G75 -->\n", + "<g id=\"node18\" class=\"node\">\n", + "<title>phase_estimate_G75</title>\n", + "<text text-anchor=\"middle\" x=\"2979.5\" y=\"-175.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G37->phase_estimate_G75 -->\n", + "<g id=\"edge44\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G37:e->phase_estimate_G75:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2879,-133.5C2904.38,-133.5 2890.76,-176.44 2913.09,-179.79\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2914.5\" cy=\"-179.89\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2897.5\" y=\"-161.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G54 -->\n", + "<g id=\"node19\" class=\"node\">\n", + "<title>system_G54</title>\n", + "<text text-anchor=\"middle\" x=\"2979.5\" y=\"-121.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G37->system_G54 -->\n", + "<g id=\"edge45\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G37:e->system_G54:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2879,-110.5C2908.2,-110.5 2914.5,-125.05 2942.28,-125.96\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2943.53\" cy=\"-125.98\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2897.5\" y=\"-115.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla_G51 -->\n", + "<g id=\"node20\" class=\"node\">\n", + "<title>walk_ancilla_G51</title>\n", + "<text text-anchor=\"middle\" x=\"2979.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G37->walk_ancilla_G51 -->\n", + "<g id=\"edge46\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G37:e->walk_ancilla_G51:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2879,-87.5C2900.71,-87.5 2904.54,-73.19 2924.86,-72.07\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2925.92\" cy=\"-72.04\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2897.5\" y=\"-85.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- guide_ancilla_G81 -->\n", + "<g id=\"node21\" class=\"node\">\n", + "<title>guide_ancilla_G81</title>\n", + "<text text-anchor=\"middle\" x=\"2979.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidedHamiltonianPhaseEstimation_G37->guide_ancilla_G81 -->\n", + "<g id=\"edge47\" class=\"edge\">\n", + "<title>GuidedHamiltonianPhaseEstimation_G37:e->guide_ancilla_G81:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2879,-64.5C2906.76,-64.5 2896.1,-21.21 2921.17,-18.17\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2922.55\" cy=\"-18.09\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2897.5\" y=\"-55.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G42->Adjoint_G27 -->\n", + "<g id=\"edge9\" class=\"edge\">\n", + "<title>ReflectAboutZero_G42:e->Adjoint_G27:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M492,-14C518.85,-14 502.43,-61.01 526.23,-64.32\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"527.5\" cy=\"-64.4\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"510.5\" y=\"-43.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G44->GuidedHamiltonianPhaseEstimation_G4 -->\n", + "<g id=\"edge14\" class=\"edge\">\n", + "<title>ReflectAboutZero_G44:e->GuidedHamiltonianPhaseEstimation_G4:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M968,-133.5C983.42,-133.5 987.99,-133.5 1002.06,-133.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1003.5\" cy=\"-133.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"986.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G44->GuidedHamiltonianPhaseEstimation_G4 -->\n", + "<g id=\"edge15\" class=\"edge\">\n", + "<title>ReflectAboutZero_G44:e->GuidedHamiltonianPhaseEstimation_G4:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M968,-110.5C983.42,-110.5 987.99,-110.5 1002.06,-110.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1003.5\" cy=\"-110.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"986.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G44->GuidedHamiltonianPhaseEstimation_G4 -->\n", + "<g id=\"edge16\" class=\"edge\">\n", + "<title>ReflectAboutZero_G44:e->GuidedHamiltonianPhaseEstimation_G4:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M968,-87.5C983.42,-87.5 987.99,-87.5 1002.06,-87.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1003.5\" cy=\"-87.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"986.5\" y=\"-90.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G44->GuidedHamiltonianPhaseEstimation_G4 -->\n", + "<g id=\"edge17\" class=\"edge\">\n", + "<title>ReflectAboutZero_G44:e->GuidedHamiltonianPhaseEstimation_G4:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M968,-64.5C983.42,-64.5 987.99,-64.5 1002.06,-64.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1003.5\" cy=\"-64.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"986.5\" y=\"-67.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "</g>\n", + "</svg>" + ], + "text/plain": [ + "<IPython.core.display.SVG object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "bloq_4_rounds = attrs.evolve(bloq, gamma=1/3)\n", + "show_bloq(bloq_4_rounds.decompose_bloq())" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "214f731f-22d8-4767-8b23-13ad1c400abf", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"3278pt\" height=\"216pt\" viewBox=\"0.00 0.00 3278.00 216.00\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 212)\">\n", + "<title>my_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-212 3274,-212 3274,4 -4,4\"/>\n", + "<!-- phase_estimate_G62 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>phase_estimate_G62</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-181.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G40 -->\n", + "<g id=\"node20\" class=\"node\">\n", + "<title>QubitizationQPE_G40</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-185.5 274,-203.5 364,-203.5 364,-185.5 274,-185.5\"/>\n", + "<text text-anchor=\"start\" x=\"276.62\" y=\"-191\" font-family=\"Times,serif\" font-size=\"10.00\">QubitizationQPE</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-162.5 274,-185.5 364,-185.5 364,-162.5 274,-162.5\"/>\n", + "<text text-anchor=\"start\" x=\"290.5\" y=\"-169.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-139.5 274,-162.5 364,-162.5 364,-139.5 274,-139.5\"/>\n", + "<text text-anchor=\"start\" x=\"293.5\" y=\"-146.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"274,-116.5 274,-139.5 364,-139.5 364,-116.5 274,-116.5\"/>\n", + "<text text-anchor=\"start\" x=\"295.75\" y=\"-123.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- phase_estimate_G62->QubitizationQPE_G40 -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>phase_estimate_G62:e->QubitizationQPE_G40:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M127,-186C191.65,-186 208.01,-174.33 271.34,-174.01\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"272.5\" cy=\"-174\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"200.5\" y=\"-187.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G112 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>system_G112</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- GuidingState -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>GuidingState</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-78 164,-96 237,-96 237,-78 164,-78\"/>\n", + "<text text-anchor=\"start\" x=\"166.75\" y=\"-83.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidingState</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-55 164,-78 237,-78 237,-55 164,-55\"/>\n", + "<text text-anchor=\"start\" x=\"168.62\" y=\"-61.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-32 164,-55 237,-55 237,-32 164,-32\"/>\n", + "<text text-anchor=\"start\" x=\"185.12\" y=\"-38.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- system_G112->GuidingState -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>system_G112:e->GuidingState:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M97.97,-72C126.5,-72 134.08,-66.84 161.3,-66.52\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-66.51\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-71.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla_G102 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>walk_ancilla_G102</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-127.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- walk_ancilla_G102->QubitizationQPE_G40 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>walk_ancilla_G102:e->QubitizationQPE_G40:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M115.58,-132C185.05,-132 203.08,-128.11 271.14,-128\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"272.5\" cy=\"-128\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"200.5\" y=\"-134.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- guide_ancilla_G78 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>guide_ancilla_G78</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- guide_ancilla_G78->GuidingState -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>guide_ancilla_G78:e->GuidingState:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M118.95,-18C141.06,-18 141.03,-41.55 161.41,-43.39\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-43.43\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-39.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- GuidingState->QubitizationQPE_G40 -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>GuidingState:e->QubitizationQPE_G40:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M237,-66.5C256.54,-66.5 253.82,-143.26 271.27,-150.46\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"272.53\" cy=\"-150.71\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"255.5\" y=\"-114.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G44 -->\n", + "<g id=\"node21\" class=\"node\">\n", + "<title>ReflectAboutZero_G44</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"382,-77.5 382,-95.5 481,-95.5 481,-77.5 382,-77.5\"/>\n", + "<text text-anchor=\"start\" x=\"386.88\" y=\"-83\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"382,-54.5 382,-77.5 481,-77.5 481,-54.5 382,-54.5\"/>\n", + "<text text-anchor=\"start\" x=\"385\" y=\"-61.2\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidingState->ReflectAboutZero_G44 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>GuidingState:e->ReflectAboutZero_G44:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M237,-43.5C301.32,-43.5 316.38,-65.39 379.35,-65.99\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"380.5\" cy=\"-65.99\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"255.5\" y=\"-48.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- Adjoint -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>Adjoint</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"499,-184.5 499,-202.5 683,-202.5 683,-184.5 499,-184.5\"/>\n", + "<text text-anchor=\"start\" x=\"501.75\" y=\"-190\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=QubitizationQPE)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"499,-161.5 499,-184.5 683,-184.5 683,-161.5 499,-161.5\"/>\n", + "<text text-anchor=\"start\" x=\"562.5\" y=\"-168.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"499,-138.5 499,-161.5 683,-161.5 683,-138.5 499,-138.5\"/>\n", + "<text text-anchor=\"start\" x=\"565.5\" y=\"-145.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"499,-115.5 499,-138.5 683,-138.5 683,-115.5 499,-115.5\"/>\n", + "<text text-anchor=\"start\" x=\"567.75\" y=\"-122.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- Adjoint_G19 -->\n", + "<g id=\"node14\" class=\"node\">\n", + "<title>Adjoint_G19</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"720,-126 720,-144 887,-144 887,-126 720,-126\"/>\n", + "<text text-anchor=\"start\" x=\"722.88\" y=\"-131.5\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=GuidingState)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"720,-103 720,-126 887,-126 887,-103 720,-103\"/>\n", + "<text text-anchor=\"start\" x=\"771.62\" y=\"-109.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"720,-80 720,-103 887,-103 887,-80 720,-80\"/>\n", + "<text text-anchor=\"start\" x=\"788.12\" y=\"-86.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- Adjoint->Adjoint_G19 -->\n", + "<g id=\"edge10\" class=\"edge\">\n", + "<title>Adjoint:e->Adjoint_G19:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M683,-150C704.9,-150 697.83,-117.22 717.47,-114.66\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"718.5\" cy=\"-114.59\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"701.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G49 -->\n", + "<g id=\"node23\" class=\"node\">\n", + "<title>ReflectAboutZero_G49</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"924,-167 924,-185 1041,-185 1041,-167 924,-167\"/>\n", + "<text text-anchor=\"start\" x=\"937.88\" y=\"-172.5\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"924,-144 924,-167 1041,-167 1041,-144 924,-144\"/>\n", + "<text text-anchor=\"start\" x=\"927\" y=\"-150.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"924,-121 924,-144 1041,-144 1041,-121 924,-121\"/>\n", + "<text text-anchor=\"start\" x=\"957\" y=\"-127.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"924,-98 924,-121 1041,-121 1041,-98 924,-98\"/>\n", + "<text text-anchor=\"start\" x=\"939.38\" y=\"-104.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"924,-75 924,-98 1041,-98 1041,-75 924,-75\"/>\n", + "<text text-anchor=\"start\" x=\"936\" y=\"-81.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- Adjoint->ReflectAboutZero_G49 -->\n", + "<g id=\"edge12\" class=\"edge\">\n", + "<title>Adjoint:e->ReflectAboutZero_G49:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M683,-173C789.45,-173 816.14,-155.81 921.19,-155.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"922.5\" cy=\"-155.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"803.5\" y=\"-175.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- Adjoint->ReflectAboutZero_G49 -->\n", + "<g id=\"edge14\" class=\"edge\">\n", + "<title>Adjoint:e->ReflectAboutZero_G49:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M683,-127C713.2,-127 693.46,-84.41 720,-70 785.22,-34.58 816.88,-45.66 887,-70 897.16,-73.53 898.53,-77.26 906,-85 914.65,-93.96 911.17,-107.22 921.15,-109.24\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"922.51\" cy=\"-109.36\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"803.5\" y=\"-73.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- GuidingState_G0 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>GuidingState_G0</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2906,-65 2906,-83 2979,-83 2979,-65 2906,-65\"/>\n", + "<text text-anchor=\"start\" x=\"2908.75\" y=\"-70.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidingState</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2906,-42 2906,-65 2979,-65 2979,-42 2906,-42\"/>\n", + "<text text-anchor=\"start\" x=\"2910.62\" y=\"-48.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2906,-19 2906,-42 2979,-42 2979,-19 2906,-19\"/>\n", + "<text text-anchor=\"start\" x=\"2927.12\" y=\"-25.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G54 -->\n", + "<g id=\"node24\" class=\"node\">\n", + "<title>QubitizationQPE_G54</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3016,-169.5 3016,-187.5 3106,-187.5 3106,-169.5 3016,-169.5\"/>\n", + "<text text-anchor=\"start\" x=\"3018.62\" y=\"-175\" font-family=\"Times,serif\" font-size=\"10.00\">QubitizationQPE</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3016,-146.5 3016,-169.5 3106,-169.5 3106,-146.5 3016,-146.5\"/>\n", + "<text text-anchor=\"start\" x=\"3032.5\" y=\"-153.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3016,-123.5 3016,-146.5 3106,-146.5 3106,-123.5 3016,-123.5\"/>\n", + "<text text-anchor=\"start\" x=\"3035.5\" y=\"-130.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3016,-100.5 3016,-123.5 3106,-123.5 3106,-100.5 3016,-100.5\"/>\n", + "<text text-anchor=\"start\" x=\"3037.75\" y=\"-107.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- GuidingState_G0->QubitizationQPE_G54 -->\n", + "<g id=\"edge49\" class=\"edge\">\n", + "<title>GuidingState_G0:e->QubitizationQPE_G54:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2979,-53.5C2997.96,-53.5 2996.32,-127.54 3013.35,-134.48\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"3014.53\" cy=\"-134.71\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2997.5\" y=\"-97.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- guide_ancilla_G88 -->\n", + "<g id=\"node28\" class=\"node\">\n", + "<title>guide_ancilla_G88</title>\n", + "<text text-anchor=\"middle\" x=\"3206.5\" y=\"-23.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- GuidingState_G0->guide_ancilla_G88 -->\n", + "<g id=\"edge54\" class=\"edge\">\n", + "<title>GuidingState_G0:e->guide_ancilla_G88:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2979,-30.5C3054.58,-30.5 3074.12,-28.06 3148.39,-28\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"3149.55\" cy=\"-28\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"3061\" y=\"-34.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>ReflectAboutZero</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1296,-73.5 1296,-91.5 1395,-91.5 1395,-73.5 1296,-73.5\"/>\n", + "<text text-anchor=\"start\" x=\"1300.88\" y=\"-79\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1296,-50.5 1296,-73.5 1395,-73.5 1395,-50.5 1296,-50.5\"/>\n", + "<text text-anchor=\"start\" x=\"1299\" y=\"-57.2\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- Adjoint_G46 -->\n", + "<g id=\"node22\" class=\"node\">\n", + "<title>Adjoint_G46</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1634,-120 1634,-138 1801,-138 1801,-120 1634,-120\"/>\n", + "<text text-anchor=\"start\" x=\"1636.88\" y=\"-125.5\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=GuidingState)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1634,-97 1634,-120 1801,-120 1801,-97 1634,-97\"/>\n", + "<text text-anchor=\"start\" x=\"1685.62\" y=\"-103.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1634,-74 1634,-97 1801,-97 1801,-74 1634,-74\"/>\n", + "<text text-anchor=\"start\" x=\"1702.12\" y=\"-80.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- ReflectAboutZero->Adjoint_G46 -->\n", + "<g id=\"edge26\" class=\"edge\">\n", + "<title>ReflectAboutZero:e->Adjoint_G46:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1395,-62C1500.8,-62 1526.81,-85.09 1631.2,-85.49\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1632.5\" cy=\"-85.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1505\" y=\"-87.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- Adjoint_G3 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>Adjoint_G3</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2548,-109 2548,-127 2715,-127 2715,-109 2548,-109\"/>\n", + "<text text-anchor=\"start\" x=\"2550.88\" y=\"-114.5\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=GuidingState)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2548,-86 2548,-109 2715,-109 2715,-86 2548,-86\"/>\n", + "<text text-anchor=\"start\" x=\"2599.62\" y=\"-92.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2548,-63 2548,-86 2715,-86 2715,-63 2548,-63\"/>\n", + "<text text-anchor=\"start\" x=\"2616.12\" y=\"-69.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G22 -->\n", + "<g id=\"node15\" class=\"node\">\n", + "<title>ReflectAboutZero_G22</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2752,-146 2752,-164 2869,-164 2869,-146 2752,-146\"/>\n", + "<text text-anchor=\"start\" x=\"2765.88\" y=\"-151.5\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2752,-123 2752,-146 2869,-146 2869,-123 2752,-123\"/>\n", + "<text text-anchor=\"start\" x=\"2755\" y=\"-129.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2752,-100 2752,-123 2869,-123 2869,-100 2752,-100\"/>\n", + "<text text-anchor=\"start\" x=\"2785\" y=\"-106.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2752,-77 2752,-100 2869,-100 2869,-77 2752,-77\"/>\n", + "<text text-anchor=\"start\" x=\"2767.38\" y=\"-83.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2752,-54 2752,-77 2869,-77 2869,-54 2752,-54\"/>\n", + "<text text-anchor=\"start\" x=\"2764\" y=\"-60.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- Adjoint_G3->ReflectAboutZero_G22 -->\n", + "<g id=\"edge43\" class=\"edge\">\n", + "<title>Adjoint_G3:e->ReflectAboutZero_G22:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2715,-97.5C2731.62,-97.5 2734.17,-110.01 2749.25,-111.38\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2750.5\" cy=\"-111.43\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2733.5\" y=\"-107.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G3->ReflectAboutZero_G22 -->\n", + "<g id=\"edge45\" class=\"edge\">\n", + "<title>Adjoint_G3:e->ReflectAboutZero_G22:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2715,-74.5C2731,-74.5 2734.69,-66.46 2749.34,-65.58\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2750.5\" cy=\"-65.54\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2733.5\" y=\"-73.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G6 -->\n", + "<g id=\"node10\" class=\"node\">\n", + "<title>ReflectAboutZero_G6</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1838,-157 1838,-175 1955,-175 1955,-157 1838,-157\"/>\n", + "<text text-anchor=\"start\" x=\"1851.88\" y=\"-162.5\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1838,-134 1838,-157 1955,-157 1955,-134 1838,-134\"/>\n", + "<text text-anchor=\"start\" x=\"1841\" y=\"-140.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1838,-111 1838,-134 1955,-134 1955,-111 1838,-111\"/>\n", + "<text text-anchor=\"start\" x=\"1871\" y=\"-117.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1838,-88 1838,-111 1955,-111 1955,-88 1838,-88\"/>\n", + "<text text-anchor=\"start\" x=\"1853.38\" y=\"-94.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1838,-65 1838,-88 1955,-88 1955,-65 1838,-65\"/>\n", + "<text text-anchor=\"start\" x=\"1850\" y=\"-71.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G27 -->\n", + "<g id=\"node16\" class=\"node\">\n", + "<title>QubitizationQPE_G27</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2102,-168.5 2102,-186.5 2192,-186.5 2192,-168.5 2102,-168.5\"/>\n", + "<text text-anchor=\"start\" x=\"2104.62\" y=\"-174\" font-family=\"Times,serif\" font-size=\"10.00\">QubitizationQPE</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2102,-145.5 2102,-168.5 2192,-168.5 2192,-145.5 2102,-145.5\"/>\n", + "<text text-anchor=\"start\" x=\"2118.5\" y=\"-152.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2102,-122.5 2102,-145.5 2192,-145.5 2192,-122.5 2102,-122.5\"/>\n", + "<text text-anchor=\"start\" x=\"2121.5\" y=\"-129.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2102,-99.5 2102,-122.5 2192,-122.5 2192,-99.5 2102,-99.5\"/>\n", + "<text text-anchor=\"start\" x=\"2123.75\" y=\"-106.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G6->QubitizationQPE_G27 -->\n", + "<g id=\"edge33\" class=\"edge\">\n", + "<title>ReflectAboutZero_G6:e->QubitizationQPE_G27:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1955,-145.5C2019.64,-145.5 2036.02,-156.69 2099.34,-156.99\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2100.5\" cy=\"-157\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2028.5\" y=\"-158.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G6->QubitizationQPE_G27 -->\n", + "<g id=\"edge35\" class=\"edge\">\n", + "<title>ReflectAboutZero_G6:e->QubitizationQPE_G27:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1955,-99.5C1963.03,-99.5 1965,-100.36 1973,-101 2029.31,-105.53 2043.98,-110.81 2099.01,-111\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2100.5\" cy=\"-111\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2028.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- GuidingState_G33 -->\n", + "<g id=\"node18\" class=\"node\">\n", + "<title>GuidingState_G33</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1992,-70 1992,-88 2065,-88 2065,-70 1992,-70\"/>\n", + "<text text-anchor=\"start\" x=\"1994.75\" y=\"-75.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidingState</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1992,-47 1992,-70 2065,-70 2065,-47 1992,-47\"/>\n", + "<text text-anchor=\"start\" x=\"1996.62\" y=\"-53.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1992,-24 1992,-47 2065,-47 2065,-24 1992,-24\"/>\n", + "<text text-anchor=\"start\" x=\"2013.12\" y=\"-30.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G6->GuidingState_G33 -->\n", + "<g id=\"edge31\" class=\"edge\">\n", + "<title>ReflectAboutZero_G6:e->GuidingState_G33:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1955,-122.5C1986.83,-122.5 1960.88,-62.44 1989.1,-58.68\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1990.5\" cy=\"-58.59\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1973.5\" y=\"-99.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G6->GuidingState_G33 -->\n", + "<g id=\"edge32\" class=\"edge\">\n", + "<title>ReflectAboutZero_G6:e->GuidingState_G33:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1955,-76.5C1978.49,-76.5 1968.43,-38.95 1989.03,-35.72\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1990.5\" cy=\"-35.61\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1973.5\" y=\"-61.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- QubitizationQPE -->\n", + "<g id=\"node11\" class=\"node\">\n", + "<title>QubitizationQPE</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1188,-179.5 1188,-197.5 1278,-197.5 1278,-179.5 1188,-179.5\"/>\n", + "<text text-anchor=\"start\" x=\"1190.62\" y=\"-185\" font-family=\"Times,serif\" font-size=\"10.00\">QubitizationQPE</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1188,-156.5 1188,-179.5 1278,-179.5 1278,-156.5 1188,-156.5\"/>\n", + "<text text-anchor=\"start\" x=\"1204.5\" y=\"-163.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1188,-133.5 1188,-156.5 1278,-156.5 1278,-133.5 1188,-133.5\"/>\n", + "<text text-anchor=\"start\" x=\"1207.5\" y=\"-140.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1188,-110.5 1188,-133.5 1278,-133.5 1278,-110.5 1188,-110.5\"/>\n", + "<text text-anchor=\"start\" x=\"1209.75\" y=\"-117.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- Adjoint_G15 -->\n", + "<g id=\"node13\" class=\"node\">\n", + "<title>Adjoint_G15</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1413,-178.5 1413,-196.5 1597,-196.5 1597,-178.5 1413,-178.5\"/>\n", + "<text text-anchor=\"start\" x=\"1415.75\" y=\"-184\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=QubitizationQPE)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1413,-155.5 1413,-178.5 1597,-178.5 1597,-155.5 1413,-155.5\"/>\n", + "<text text-anchor=\"start\" x=\"1476.5\" y=\"-162.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1413,-132.5 1413,-155.5 1597,-155.5 1597,-132.5 1413,-132.5\"/>\n", + "<text text-anchor=\"start\" x=\"1479.5\" y=\"-139.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1413,-109.5 1413,-132.5 1597,-132.5 1597,-109.5 1413,-109.5\"/>\n", + "<text text-anchor=\"start\" x=\"1481.75\" y=\"-116.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- QubitizationQPE->Adjoint_G15 -->\n", + "<g id=\"edge22\" class=\"edge\">\n", + "<title>QubitizationQPE:e->Adjoint_G15:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1278,-168C1337.06,-168 1352.52,-167.03 1410.22,-167\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1411.5\" cy=\"-167\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1345.5\" y=\"-170.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- QubitizationQPE->Adjoint_G15 -->\n", + "<g id=\"edge23\" class=\"edge\">\n", + "<title>QubitizationQPE:e->Adjoint_G15:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1278,-145C1337.06,-145 1352.52,-144.03 1410.22,-144\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1411.5\" cy=\"-144\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1345.5\" y=\"-147.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- QubitizationQPE->Adjoint_G15 -->\n", + "<g id=\"edge24\" class=\"edge\">\n", + "<title>QubitizationQPE:e->Adjoint_G15:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1278,-122C1337.06,-122 1352.52,-121.03 1410.22,-121\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1411.5\" cy=\"-121\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1345.5\" y=\"-124.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- GuidingState_G12 -->\n", + "<g id=\"node12\" class=\"node\">\n", + "<title>GuidingState_G12</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1078,-80 1078,-98 1151,-98 1151,-80 1078,-80\"/>\n", + "<text text-anchor=\"start\" x=\"1080.75\" y=\"-85.5\" font-family=\"Times,serif\" font-size=\"10.00\">GuidingState</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1078,-57 1078,-80 1151,-80 1151,-57 1078,-57\"/>\n", + "<text text-anchor=\"start\" x=\"1082.62\" y=\"-63.7\" font-family=\"Times,serif\" font-size=\"14.00\">selection</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1078,-34 1078,-57 1151,-57 1151,-34 1078,-34\"/>\n", + "<text text-anchor=\"start\" x=\"1099.12\" y=\"-40.7\" font-family=\"Times,serif\" font-size=\"14.00\">junk</text>\n", + "</g>\n", + "<!-- GuidingState_G12->ReflectAboutZero -->\n", + "<g id=\"edge21\" class=\"edge\">\n", + "<title>GuidingState_G12:e->ReflectAboutZero:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1151,-45.5C1214.97,-45.5 1230.71,-61.55 1293.37,-61.99\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1294.5\" cy=\"-61.99\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1169.5\" y=\"-49.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- GuidingState_G12->QubitizationQPE -->\n", + "<g id=\"edge19\" class=\"edge\">\n", + "<title>GuidingState_G12:e->QubitizationQPE:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1151,-68.5C1169,-68.5 1169.14,-138 1185.47,-144.51\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1186.53\" cy=\"-144.72\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1169.5\" y=\"-109.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G15->ReflectAboutZero_G6 -->\n", + "<g id=\"edge27\" class=\"edge\">\n", + "<title>Adjoint_G15:e->ReflectAboutZero_G6:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1597,-167C1649.82,-167 1779.56,-146.25 1835.09,-145.52\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1836.5\" cy=\"-145.51\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1717.5\" y=\"-167.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- Adjoint_G15->ReflectAboutZero_G6 -->\n", + "<g id=\"edge29\" class=\"edge\">\n", + "<title>Adjoint_G15:e->ReflectAboutZero_G6:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1597,-121C1627.2,-121 1607.46,-78.41 1634,-64 1699.22,-28.58 1730.09,-42.06 1801,-64 1810.77,-67.02 1812.5,-70.04 1820,-77 1828.65,-85.03 1825.77,-97.38 1835.3,-99.26\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1836.51\" cy=\"-99.37\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1717.5\" y=\"-67.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- Adjoint_G15->Adjoint_G46 -->\n", + "<g id=\"edge25\" class=\"edge\">\n", + "<title>Adjoint_G15:e->Adjoint_G46:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1597,-144C1618.9,-144 1611.83,-111.22 1631.47,-108.66\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1632.5\" cy=\"-108.59\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1615.5\" y=\"-130.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G19->ReflectAboutZero_G49 -->\n", + "<g id=\"edge13\" class=\"edge\">\n", + "<title>Adjoint_G19:e->ReflectAboutZero_G49:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M887,-114.5C904.29,-114.5 905.61,-130.59 921.15,-132.34\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"922.5\" cy=\"-132.42\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"905.5\" y=\"-126.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G19->ReflectAboutZero_G49 -->\n", + "<g id=\"edge15\" class=\"edge\">\n", + "<title>Adjoint_G19:e->ReflectAboutZero_G49:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M887,-91.5C902.56,-91.5 906.88,-87.11 921.03,-86.56\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"922.5\" cy=\"-86.53\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"905.5\" y=\"-92.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G22->GuidingState_G0 -->\n", + "<g id=\"edge46\" class=\"edge\">\n", + "<title>ReflectAboutZero_G22:e->GuidingState_G0:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2869,-111.5C2898.62,-111.5 2876.88,-57.07 2903.29,-53.67\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2904.5\" cy=\"-53.59\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2887.5\" y=\"-88.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G22->GuidingState_G0 -->\n", + "<g id=\"edge47\" class=\"edge\">\n", + "<title>ReflectAboutZero_G22:e->GuidingState_G0:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2869,-65.5C2890.58,-65.5 2884.07,-33.7 2903.01,-30.72\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2904.5\" cy=\"-30.61\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2887.5\" y=\"-53.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G22->QubitizationQPE_G54 -->\n", + "<g id=\"edge48\" class=\"edge\">\n", + "<title>ReflectAboutZero_G22:e->QubitizationQPE_G54:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2869,-134.5C2934.26,-134.5 2949.43,-157.36 3013.31,-157.99\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"3014.5\" cy=\"-157.99\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2942.5\" y=\"-158.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G22->QubitizationQPE_G54 -->\n", + "<g id=\"edge50\" class=\"edge\">\n", + "<title>ReflectAboutZero_G22:e->QubitizationQPE_G54:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2869,-88.5C2884.77,-88.5 2988.99,-109.85 3013.05,-111.85\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"3014.5\" cy=\"-111.92\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2942.5\" y=\"-109.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- Adjoint_G36 -->\n", + "<g id=\"node19\" class=\"node\">\n", + "<title>Adjoint_G36</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2327,-167.5 2327,-185.5 2511,-185.5 2511,-167.5 2327,-167.5\"/>\n", + "<text text-anchor=\"start\" x=\"2329.75\" y=\"-173\" font-family=\"Times,serif\" font-size=\"10.00\">Adjoint(subbloq=QubitizationQPE)</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2327,-144.5 2327,-167.5 2511,-167.5 2511,-144.5 2327,-144.5\"/>\n", + "<text text-anchor=\"start\" x=\"2390.5\" y=\"-151.2\" font-family=\"Times,serif\" font-size=\"14.00\">qpe_reg</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2327,-121.5 2327,-144.5 2511,-144.5 2511,-121.5 2327,-121.5\"/>\n", + "<text text-anchor=\"start\" x=\"2393.5\" y=\"-128.2\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2327,-98.5 2327,-121.5 2511,-121.5 2511,-98.5 2327,-98.5\"/>\n", + "<text text-anchor=\"start\" x=\"2395.75\" y=\"-105.2\" font-family=\"Times,serif\" font-size=\"14.00\">ancilla</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G27->Adjoint_G36 -->\n", + "<g id=\"edge37\" class=\"edge\">\n", + "<title>QubitizationQPE_G27:e->Adjoint_G36:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2192,-157C2251.06,-157 2266.52,-156.03 2324.22,-156\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2325.5\" cy=\"-156\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2259.5\" y=\"-159.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G27->Adjoint_G36 -->\n", + "<g id=\"edge38\" class=\"edge\">\n", + "<title>QubitizationQPE_G27:e->Adjoint_G36:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2192,-134C2251.06,-134 2266.52,-133.03 2324.22,-133\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2325.5\" cy=\"-133\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2259.5\" y=\"-136.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G27->Adjoint_G36 -->\n", + "<g id=\"edge39\" class=\"edge\">\n", + "<title>QubitizationQPE_G27:e->Adjoint_G36:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2192,-111C2251.06,-111 2266.52,-110.03 2324.22,-110\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2325.5\" cy=\"-110\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2259.5\" y=\"-113.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G31 -->\n", + "<g id=\"node17\" class=\"node\">\n", + "<title>ReflectAboutZero_G31</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2210,-65.5 2210,-83.5 2309,-83.5 2309,-65.5 2210,-65.5\"/>\n", + "<text text-anchor=\"start\" x=\"2214.88\" y=\"-71\" font-family=\"Times,serif\" font-size=\"10.00\">ReflectAboutZero</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2210,-42.5 2210,-65.5 2309,-65.5 2309,-42.5 2210,-42.5\"/>\n", + "<text text-anchor=\"start\" x=\"2213\" y=\"-49.2\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G31->Adjoint_G3 -->\n", + "<g id=\"edge41\" class=\"edge\">\n", + "<title>ReflectAboutZero_G31:e->Adjoint_G3:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2309,-54C2414.68,-54 2440.93,-74.14 2545.21,-74.5\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2546.5\" cy=\"-74.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2419\" y=\"-77.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- GuidingState_G33->QubitizationQPE_G27 -->\n", + "<g id=\"edge34\" class=\"edge\">\n", + "<title>GuidingState_G33:e->QubitizationQPE_G27:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2065,-58.5C2082.66,-58.5 2083.3,-125.97 2099.1,-133.35\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2100.54\" cy=\"-133.67\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2083.5\" y=\"-99.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- GuidingState_G33->ReflectAboutZero_G31 -->\n", + "<g id=\"edge36\" class=\"edge\">\n", + "<title>GuidingState_G33:e->ReflectAboutZero_G31:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2065,-35.5C2129.08,-35.5 2144.61,-53.5 2207.36,-53.99\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2208.5\" cy=\"-53.99\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2083.5\" y=\"-40.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- Adjoint_G36->Adjoint_G3 -->\n", + "<g id=\"edge40\" class=\"edge\">\n", + "<title>Adjoint_G36:e->Adjoint_G3:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2511,-133C2532.9,-133 2525.83,-100.22 2545.47,-97.66\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2546.5\" cy=\"-97.59\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2529.5\" y=\"-119.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G36->ReflectAboutZero_G22 -->\n", + "<g id=\"edge42\" class=\"edge\">\n", + "<title>Adjoint_G36:e->ReflectAboutZero_G22:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2511,-156C2563.82,-156 2693.56,-135.25 2749.09,-134.52\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2750.5\" cy=\"-134.51\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2631.5\" y=\"-156.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- Adjoint_G36->ReflectAboutZero_G22 -->\n", + "<g id=\"edge44\" class=\"edge\">\n", + "<title>Adjoint_G36:e->ReflectAboutZero_G22:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2511,-110C2541.2,-110 2521.46,-67.41 2548,-53 2613.22,-17.58 2644.09,-31.06 2715,-53 2724.77,-56.02 2726.5,-59.04 2734,-66 2742.65,-74.03 2739.77,-86.38 2749.3,-88.26\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"2750.51\" cy=\"-88.37\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"2631.5\" y=\"-56.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G40->Adjoint -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>QubitizationQPE_G40:e->Adjoint:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M364,-174C423.06,-174 438.52,-173.03 496.22,-173\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"497.5\" cy=\"-173\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"431.5\" y=\"-176.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G40->Adjoint -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>QubitizationQPE_G40:e->Adjoint:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M364,-151C423.06,-151 438.52,-150.03 496.22,-150\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"497.5\" cy=\"-150\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"431.5\" y=\"-153.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G40->Adjoint -->\n", + "<g id=\"edge9\" class=\"edge\">\n", + "<title>QubitizationQPE_G40:e->Adjoint:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M364,-128C423.06,-128 438.52,-127.03 496.22,-127\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"497.5\" cy=\"-127\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"431.5\" y=\"-130.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G44->Adjoint_G19 -->\n", + "<g id=\"edge11\" class=\"edge\">\n", + "<title>ReflectAboutZero_G44:e->Adjoint_G19:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M481,-66C586.89,-66 612.72,-91.05 717.2,-91.49\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"718.5\" cy=\"-91.5\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"591\" y=\"-93.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- Adjoint_G46->ReflectAboutZero_G6 -->\n", + "<g id=\"edge28\" class=\"edge\">\n", + "<title>Adjoint_G46:e->ReflectAboutZero_G6:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1801,-108.5C1817.62,-108.5 1820.17,-121.01 1835.25,-122.38\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1836.5\" cy=\"-122.43\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1819.5\" y=\"-118.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- Adjoint_G46->ReflectAboutZero_G6 -->\n", + "<g id=\"edge30\" class=\"edge\">\n", + "<title>Adjoint_G46:e->ReflectAboutZero_G6:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1801,-85.5C1817,-85.5 1820.69,-77.46 1835.34,-76.58\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1836.5\" cy=\"-76.54\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1819.5\" y=\"-84.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G49->QubitizationQPE -->\n", + "<g id=\"edge18\" class=\"edge\">\n", + "<title>ReflectAboutZero_G49:e->QubitizationQPE:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1041,-155.5C1105.67,-155.5 1121.99,-167.66 1185.34,-167.99\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1186.5\" cy=\"-168\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1114.5\" y=\"-169.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G49->QubitizationQPE -->\n", + "<g id=\"edge20\" class=\"edge\">\n", + "<title>ReflectAboutZero_G49:e->QubitizationQPE:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1041,-109.5C1041.94,-109.5 1165.21,-120.12 1185.26,-121.78\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1186.5\" cy=\"-121.88\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1114.5\" y=\"-121.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G49->GuidingState_G12 -->\n", + "<g id=\"edge16\" class=\"edge\">\n", + "<title>ReflectAboutZero_G49:e->GuidingState_G12:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1041,-132.5C1072.83,-132.5 1046.88,-72.44 1075.1,-68.68\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1076.5\" cy=\"-68.59\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1059.5\" y=\"-109.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- ReflectAboutZero_G49->GuidingState_G12 -->\n", + "<g id=\"edge17\" class=\"edge\">\n", + "<title>ReflectAboutZero_G49:e->GuidingState_G12:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1041,-86.5C1064.49,-86.5 1054.43,-48.95 1075.03,-45.72\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"1076.5\" cy=\"-45.61\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"1059.5\" y=\"-71.25\" font-family=\"Times,serif\" font-size=\"10.00\">A</text>\n", + "</g>\n", + "<!-- phase_estimate_G79 -->\n", + "<g id=\"node25\" class=\"node\">\n", + "<title>phase_estimate_G79</title>\n", + "<text text-anchor=\"middle\" x=\"3206.5\" y=\"-185.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G54->phase_estimate_G79 -->\n", + "<g id=\"edge51\" class=\"edge\">\n", + "<title>QubitizationQPE_G54:e->phase_estimate_G79:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M3106,-158C3126.72,-158 3121.8,-187.07 3140.12,-189.8\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"3141.5\" cy=\"-189.89\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"3124.5\" y=\"-177.25\" font-family=\"Times,serif\" font-size=\"10.00\">ceiling(lo ...</text>\n", + "</g>\n", + "<!-- system_G65 -->\n", + "<g id=\"node26\" class=\"node\">\n", + "<title>system_G65</title>\n", + "<text text-anchor=\"middle\" x=\"3206.5\" y=\"-131.32\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G54->system_G65 -->\n", + "<g id=\"edge52\" class=\"edge\">\n", + "<title>QubitizationQPE_G54:e->system_G65:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M3106,-135C3134.43,-135 3142.2,-135.94 3169.34,-136\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"3170.53\" cy=\"-136\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"3124.5\" y=\"-138.25\" font-family=\"Times,serif\" font-size=\"10.00\">N</text>\n", + "</g>\n", + "<!-- walk_ancilla_G61 -->\n", + "<g id=\"node27\" class=\"node\">\n", + "<title>walk_ancilla_G61</title>\n", + "<text text-anchor=\"middle\" x=\"3206.5\" y=\"-77.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- QubitizationQPE_G54->walk_ancilla_G61 -->\n", + "<g id=\"edge53\" class=\"edge\">\n", + "<title>QubitizationQPE_G54:e->walk_ancilla_G61:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M3106,-112C3130.33,-112 3129.24,-84.3 3151.58,-82.13\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"3152.93\" cy=\"-82.07\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"3124.5\" y=\"-106.25\" font-family=\"Times,serif\" font-size=\"10.00\">N + 1</text>\n", + "</g>\n", + "</g>\n", + "</svg>" + ], + "text/plain": [ + "<IPython.core.display.SVG object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_bloq(bloq_4_rounds.decompose_bloq().flatten_once())" + ] + }, + { + "cell_type": "markdown", + "id": "f131e5ff-4d5b-487b-a84c-56c68a411f71", + "metadata": {}, + "source": [ + "## Query and gate costs\n", + "We will count queries to the above oracles, and arbitrary 1/2-qubit gates as described in the paper." + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "cf13f9e4-c65a-41f6-94ef-70168a136191", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.max_k_xor_sat.shims import generalize_1_2_qubit_gates\n", + "\n", + "g, sigma = bloq.call_graph(\n", + " generalizer=[ignore_alloc_free, ignore_split_join, generalize_1_2_qubit_gates]\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "18fee717-4117-47ce-8929-1aa3e7fba91a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "#### Counts totals:\n", + " - `And`: $\\displaystyle \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left(4 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} + N \\left(2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 2\\right) + N \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 2\\right) + N - 4\\right) + \\left(A + 2 N + \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + \\left(4 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} + N \\left(2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 2\\right) + N \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 2\\right) + N - 4\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$\n", + " - `Andā `: $\\displaystyle \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left(4 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} + N \\left(2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 2\\right) + N \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 2\\right) + N - 4\\right) + \\left(A + 2 N + \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + \\left(4 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} + N \\left(2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 2\\right) + N \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 2\\right) + N - 4\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$\n", + " - `ArbitraryGate`: $\\displaystyle 2 \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil + 2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil$\n", + " - `ArbitraryGate`: $\\displaystyle \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left(4 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil + G + \\left(2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 2\\right) \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil + 3\\right) + \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor + 13 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil + 2 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\left\\lfloor{2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}}\\right\\rfloor \\right)}}\\right\\rceil + \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor - 16\\right) + \\left(4 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil + G + \\left(2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 2\\right) \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil + 3\\right) + \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor + 13 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil + 2 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\left\\lfloor{2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}}\\right\\rfloor \\right)}}\\right\\rceil + \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor - 16\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$\n", + " - `C[oracle_O_F]`: $\\displaystyle 2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 2$\n", + " - `C[oracle_O_F]`: $\\displaystyle 2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$\n", + " - `C[oracle_O_H]`: $\\displaystyle 4 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 2$\n", + " - `PrepareIdentity`: $\\displaystyle \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left(2 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} + 4 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 6\\right) + \\left(2 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} + 4 \\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 6\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$\n", + " - `oracle_O_F`: $\\displaystyle \\left(2 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 4\\right) \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right)$\n", + " - `oracle_O_F`: $\\displaystyle \\left(2 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 4\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$\n", + " - `oracle_O_H`: $\\displaystyle \\left(2 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 4\\right) \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) + \\left(2 \\cdot 2^{\\left\\lceil{\\operatorname{log}_{2}{\\left(\\frac{s \\log{\\left(\\frac{1}{\\gamma^{3}} \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil} - 4\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$" + ], + "text/plain": [ + "<IPython.core.display.Markdown object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_counts_sigma(sigma)" + ] + }, + { + "cell_type": "markdown", + "id": "a6083b59-ed3f-4543-ba28-d7f7b19d2b5a", + "metadata": {}, + "source": [ + "### Cost from the paper\n", + "Theorem 4.9 of the paper states that the algorithm uses:\n", + "1. $Q = \\widetilde{O}(s / (\\gamma \\alpha \\lambda))$ queries to oracles for H\n", + "2. $\\widetilde{O}(G/\\gamma + \\text{polylog}(Q)/\\gamma + QN)$ gates\n", + "\n", + "Let us simplify the symbolic costs obtained above and verify if they match." + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "9e03abf4-efd3-46b0-83d7-bf3b1b0554a5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "#### Counts totals:\n", + " - `And`: $\\displaystyle \\frac{\\alpha \\lambda \\left(A + 2 N + \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left(- 2 N \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) + \\alpha \\lambda \\left(2 N \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) + N - 4\\right) - 24 s \\log{\\left(\\gamma \\right)}\\right) + \\left(- 2 N \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) + \\alpha \\lambda \\left(2 N \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) + N - 4\\right) - 24 s \\log{\\left(\\gamma \\right)}\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil}{\\alpha \\lambda}$\n", + " - `Andā `: $\\displaystyle \\frac{\\alpha \\lambda \\left(A + 2 N + \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left(- 2 N \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) + \\alpha \\lambda \\left(2 N \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) + N - 4\\right) - 24 s \\log{\\left(\\gamma \\right)}\\right) + \\left(- 2 N \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) + \\alpha \\lambda \\left(2 N \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) + N - 4\\right) - 24 s \\log{\\left(\\gamma \\right)}\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil}{\\alpha \\lambda}$\n", + " - `ArbitraryGate`: $\\displaystyle 2 \\cdot \\left(2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil$\n", + " - `ArbitraryGate`: $\\displaystyle \\frac{2 \\alpha \\lambda \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right) \\left(\\alpha \\lambda \\left(G + \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor + 15 \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil + \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor - 16\\right) - 24 s \\log{\\left(\\gamma \\right)} \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 2 \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil + 3\\right)\\right) + \\left(\\alpha \\lambda \\left(G + \\left(\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 1\\right) \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor + 15 \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil + \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor - 16\\right) - 24 s \\log{\\left(\\gamma \\right)} \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 2 \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil + 3\\right)\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil}{\\alpha \\lambda}$\n", + " - `C[oracle_O_F]`: $\\displaystyle 2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 2$\n", + " - `C[oracle_O_F]`: $\\displaystyle 2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil$\n", + " - `C[oracle_O_H]`: $\\displaystyle 4 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 2$\n", + " - `PrepareIdentity`: $\\displaystyle \\frac{2 \\left(\\alpha \\lambda \\left(2 \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 3\\right) - 6 s \\log{\\left(\\gamma \\right)}\\right) \\left(2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right)}{\\alpha \\lambda}$\n", + " - `oracle_O_F`: $\\displaystyle - \\frac{4 \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) \\left(\\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil + 1\\right)}{\\alpha \\lambda}$\n", + " - `oracle_O_F`: $\\displaystyle \\frac{4 \\left(- \\alpha \\lambda - 3 s \\log{\\left(\\gamma \\right)}\\right) \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil}{\\alpha \\lambda}$\n", + " - `oracle_O_H`: $\\displaystyle \\frac{4 \\left(\\alpha \\lambda + 3 s \\log{\\left(\\gamma \\right)}\\right) \\left(- 2 \\left\\lceil{\\frac{1}{\\gamma}}\\right\\rceil - 1\\right)}{\\alpha \\lambda}$" + ], + "text/plain": [ + "<IPython.core.display.Markdown object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "def simplify_2_pow_log(my_expr, inner_term):\n", + " # replace `2**(ceil(log2(T)))` upper bound `2T`.\n", + " temp = sympy.symbols(f\"_temp\", positive=True, integer=True)\n", + " my_expr = my_expr.replace(ceil(log2(inner_term)), temp)\n", + " my_expr = my_expr.replace(2**temp, 2 * inner_term)\n", + " my_expr = my_expr.replace(temp, ceil(log2(inner_term)))\n", + " return my_expr\n", + "\n", + "def simplify_expression(expr):\n", + " if not is_symbolic(expr): return expr\n", + " N, A, G, s = sympy.symbols(\"N A G s\", positive=True, integer=True)\n", + " lambd, alpha, gamma = sympy.symbols(r\"\\lambda \\alpha \\gamma\", positive=True, real=True)\n", + "\n", + " expr = simplify_2_pow_log(expr, (s * ln(1/gamma**3)) / (alpha * lambd))\n", + " expr = sympy.simplify(expr)\n", + " return expr\n", + "\n", + "sigma_simpl = {k: simplify_expression(v) for k, v in sigma.items()}\n", + "show_counts_sigma(sigma_simpl)" + ] + }, + { + "cell_type": "markdown", + "id": "2676ae19-41b6-49a9-a16f-706e74b19cf9", + "metadata": {}, + "source": [ + "### Cost of Phase Estimation\n", + "\n", + "For simplicity, we can also look at the cost of a single phase estimation call (which is repeated $1/\\gamma$ times to obtain the above algorithm)." + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "355eab2b-e136-4ff1-b131-a63248bbee31", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "#### Counts totals:\n", + " - `And`: $\\displaystyle 2 N \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\log{\\left(\\gamma^{\\frac{3 s}{\\alpha \\lambda}} \\right)} \\right)}}\\right\\rceil - 3 N - 4 - \\frac{\\log{\\left(\\gamma^{24 s} \\gamma^{6 N s} \\right)}}{\\alpha \\lambda}$\n", + " - `Andā `: $\\displaystyle 2 N \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\log{\\left(\\gamma^{\\frac{3 s}{\\alpha \\lambda}} \\right)} \\right)}}\\right\\rceil - 3 N - 4 - \\frac{\\log{\\left(\\gamma^{24 s} \\gamma^{6 N s} \\right)}}{\\alpha \\lambda}$\n", + " - `ArbitraryGate`: $\\displaystyle 2 \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil$\n", + " - `ArbitraryGate`: $\\displaystyle G - 4 \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil + \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil \\left\\lfloor{\\frac{\\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{2}}\\right\\rfloor + 15 \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 22 - \\frac{12 s \\log{\\left(\\gamma \\right)} \\left\\lceil{\\operatorname{log}_{2}{\\left(s \\right)}}\\right\\rceil}{\\alpha \\lambda} - \\frac{24 s \\log{\\left(\\gamma \\right)} \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil}{\\alpha \\lambda} - \\frac{18 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda}$\n", + " - `C[oracle_O_F]`: 2\n", + " - `C[oracle_O_H]`: 2\n", + " - `PrepareIdentity`: $\\displaystyle 4 \\left\\lceil{\\operatorname{log}_{2}{\\left(- \\frac{3 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda} \\right)}}\\right\\rceil - 6 - \\frac{12 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda}$\n", + " - `oracle_O_F`: $\\displaystyle -4 - \\frac{12 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda}$\n", + " - `oracle_O_H`: $\\displaystyle -4 - \\frac{12 s \\log{\\left(\\gamma \\right)}}{\\alpha \\lambda}$" + ], + "text/plain": [ + "<IPython.core.display.Markdown object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "g_pe, sigma_pe = bloq.qpe_bloq.call_graph(\n", + " generalizer=[ignore_alloc_free, ignore_split_join, generalize_1_2_qubit_gates]\n", + ")\n", + "sigma_pe = {k: simplify_expression(v) for k, v in sigma_pe.items()}\n", + "show_counts_sigma(sigma_pe)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8cda3ad1-8183-4091-9faf-6c777a283951", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/walk_operator.py b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/walk_operator.py new file mode 100644 index 000000000..48cf3447e --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/guided_hamiltonian/walk_operator.py @@ -0,0 +1,95 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from functools import cached_property + +import attrs + +from qualtran import BloqBuilder, Signature, SoquetT +from qualtran.bloqs.block_encoding import BlockEncoding +from qualtran.bloqs.reflections.reflection_using_prepare import ReflectionUsingPrepare +from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare +from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator +from qualtran.symbolics import SymbolicFloat, SymbolicInt + + +@attrs.frozen +class QubitizedWalkOperator(BlockEncoding): + r"""Construct a Szegedy Quantum Walk operator of a block encoding. + + Args: + block_encoding: The input block-encoding. + + References: + [Encoding Electronic Spectra in Quantum Circuits with Linear T Complexity](https://arxiv.org/abs/1805.03662). + Babbush et. al. (2018). Figure 1. + """ + + block_encoding: BlockEncoding + + @property + def alpha(self) -> SymbolicFloat: + return self.block_encoding.alpha + + @property + def system_bitsize(self) -> SymbolicInt: + return self.block_encoding.system_bitsize + + @property + def ancilla_bitsize(self) -> SymbolicInt: + return self.block_encoding.ancilla_bitsize + + @property + def resource_bitsize(self) -> SymbolicInt: + return self.block_encoding.resource_bitsize + + @property + def epsilon(self) -> SymbolicFloat: + return self.block_encoding.epsilon + + @property + def signal_state(self) -> BlackBoxPrepare: + return self.block_encoding.signal_state + + @cached_property + def signature(self) -> Signature: + return self.block_encoding.signature + + @cached_property + def reflect(self) -> ReflectionUsingPrepare: + return ReflectionUsingPrepare(self.block_encoding.signal_state, global_phase=-1) + + def build_composite_bloq(self, bb: 'BloqBuilder', **soqs: 'SoquetT') -> dict[str, 'SoquetT']: + soqs |= bb.add_d(self.block_encoding, **soqs) + soqs |= bb.add_d( + self.reflect, **{reg.name: soqs[reg.name] for reg in self.reflect.signature} + ) + return soqs + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: + return {self.block_encoding: 1, self.reflect: 1} + + def __str__(self): + return f'Walk[{self.block_encoding}]' diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list.ipynb b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list.ipynb new file mode 100644 index 000000000..efb128a69 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list.ipynb @@ -0,0 +1,180 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "3c1703d8", + "metadata": { + "cq.autogen": "title_cell" + }, + "source": [ + "# Planted Noisy kXOR: Kikuchi Adjacency List" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ece15719", + "metadata": { + "cq.autogen": "top_imports" + }, + "outputs": [], + "source": [ + "from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", + "from qualtran import QBit, QInt, QUInt, QAny\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", + "from typing import *\n", + "import numpy as np\n", + "import sympy\n", + "import cirq" + ] + }, + { + "cell_type": "markdown", + "id": "c187b17d", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.bloq_doc.md" + }, + "source": [ + "## `KikuchiNonZeroIndex`\n", + "Adjacency list oracle $O_F$ for the Kikuchi matrix.\n", + "\n", + "The oracle $O_F$ (Definition 4.5) takes in $i, k$,\n", + "and outputs $i, f(i, k)$ where $f(i, k)$ is\n", + "index of the $k$-th non-zero entry in row $i$.\n", + "\n", + "As the Kikuchi matrix is symmetric, we can use the same oracle for both rows and columns.\n", + "\n", + "The Kikuchi matrix is indexed by $S \\in {[n] \\choose k}$.\n", + "For a given row $S$ and column $T$, the entry $\\mathcal{K}_{k}_{S, T}$\n", + "is potentially non-zero if $S \\Delta T = U_j$ for some $j$, which is\n", + "equivalent to $T = S \\Delta U_j$.\n", + "Here, $U_j$ is the $j$-th unique scope in the instance $\\mathcal{I}$.\n", + "\n", + "To find the $k$-th non-zero entry, we use two oracles:\n", + "1. $(S, k) \\mapsto f(S, k)$, implemented by `ColumnOfKthNonZeroEntry`\n", + "2. $(S, f(S, k)) \\mapsto k$, implemented by `IndexOfNonZeroColumn`.\n", + "\n", + "Both these above oracles are unitary: they do not have any entangled ancilla/junk registers.\n", + "\n", + "\n", + "Note on sparsity: This bloq expects the user to provide the sparsity, as it is in general\n", + "difficult to compute the precise sparsity of the Kikuchi matrix efficiently. As long as the\n", + "provided number is at least the true sparsity, the algorithm will work as expected.\n", + "In case the provides sparsity is smaller, it is equivalent to making the remaining entries zero in the final block encoding.\n", + "\n", + "#### Parameters\n", + " - `inst`: the kXOR instance $\\mathcal{I}$.\n", + " - `ell`: Kikuchi parameter $\\ell$.\n", + " - `s`: sparsity, i.e. max number of non-zero entries in a row/column. \n", + "\n", + "#### Registers\n", + " - `i`: integer in [2^N]\n", + " - `k`: integer in [2^N] \n", + "\n", + "#### References\n", + " - [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1). Theorem 4.17, proof para 4 (top of page 39).\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d329e657", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.bloq_doc.py" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat import KikuchiNonZeroIndex" + ] + }, + { + "cell_type": "markdown", + "id": "8516f446", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.example_instances.md" + }, + "source": [ + "### Example Instances" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "409ea009", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.kikuchi_nonzero_index" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import example_kxor_instance\n", + "\n", + "inst = example_kxor_instance()\n", + "ell = 8\n", + "s = inst.brute_force_sparsity(ell)\n", + "\n", + "kikuchi_nonzero_index = KikuchiNonZeroIndex(inst, ell, s=s)" + ] + }, + { + "cell_type": "markdown", + "id": "c08eb466", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.graphical_signature.md" + }, + "source": [ + "#### Graphical Signature" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a7478a9a", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.graphical_signature.py" + }, + "outputs": [], + "source": [ + "from qualtran.drawing import show_bloqs\n", + "show_bloqs([kikuchi_nonzero_index],\n", + " ['`kikuchi_nonzero_index`'])" + ] + }, + { + "cell_type": "markdown", + "id": "2e07ff5a", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.call_graph.md" + }, + "source": [ + "### Call Graph" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "138befd7", + "metadata": { + "cq.autogen": "KikuchiNonZeroIndex.call_graph.py" + }, + "outputs": [], + "source": [ + "from qualtran.resource_counting.generalizers import ignore_split_join\n", + "kikuchi_nonzero_index_g, kikuchi_nonzero_index_sigma = kikuchi_nonzero_index.call_graph(max_depth=1, generalizer=ignore_split_join)\n", + "show_call_graph(kikuchi_nonzero_index_g)\n", + "show_counts_sigma(kikuchi_nonzero_index_sigma)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list.py b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list.py new file mode 100644 index 000000000..8b970e627 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list.py @@ -0,0 +1,362 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from collections import Counter + +import numpy as np +import sympy +from attrs import frozen + +from qualtran import ( + Bloq, + bloq_example, + BloqBuilder, + BloqDocSpec, + QBit, + QUInt, + Register, + Signature, + Soquet, + SoquetT, +) +from qualtran.bloqs.arithmetic import AddK, Equals, Xor +from qualtran.bloqs.arithmetic.lists import SymmetricDifference +from qualtran.bloqs.basic_gates import CNOT, ZeroEffect, ZeroState +from qualtran.bloqs.mcmt import And +from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator +from qualtran.symbolics import SymbolicInt + +from .kxor_instance import KXorInstance + + +@frozen +class ColumnOfKthNonZeroEntry(Bloq): + r"""Given $(S, k)$, compute the column of the $k$-th non-zero entry in row $S$. + + If the output is denoted as $f(S, k)$, then this bloq maps + $(S, k, z, b)$ to $(S, k, z \oplus f'(S, k), b \oplus (k \ge s))$. + where $s$ is the sparsity, and $f'(S, k)$ is by extending $f$ + such that for all $k \ge s$, $f'(S, k) = k$. + Using $f'$ ensures the computation is reversible. + Note: we must use the same extension $f'$ for both oracles. + + This algorithm is described by the following pseudo-code: + ``` + def forward(S, k) -> f_S_k: + nnz := 0 # counter + for j in range(\bar{m}): + T := S \Delta U_j + if |T| == l: + nnz := nnz + 1 + if nnz == k: + f_S_k ^= T + ``` + + Args: + inst: the kXOR instance $\mathcal{I}$. + ell: Kikuchi parameter $\ell$. + + Registers: + S: index register to store $S \in {[n] \choose \ell}$. + k: non-zero entry index register + T: index register to store output $T = f(S, k) \in {[n] \choose \ell}$. + """ + + inst: KXorInstance + ell: SymbolicInt + + @property + def signature(self) -> 'Signature': + return Signature( + [ + Register('S', self.index_dtype, shape=(self.ell,)), + Register('k', self.index_dtype, shape=(self.ell,)), + Register('T', self.index_dtype, shape=(self.ell,)), + Register('flag', QBit()), + ] + ) + + @property + def index_dtype(self) -> QUInt: + return QUInt(self.inst.index_bitsize) + + def adjoint(self) -> 'ColumnOfKthNonZeroEntry': + return self + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> 'BloqCountDictT': + m = self.inst.num_unique_constraints + ell, k = self.ell, self.inst.k + + counts_forward = Counter[Bloq]() + + # compute symmetric differences for each constraint + counts_forward[SymmetricDifference(ell, k, ell, self.index_dtype)] += m + + # counter + counts_forward[AddK(self.index_dtype, 1).controlled()] += m + + # compare counter each time + counts_forward[Equals(self.index_dtype)] += m + + # when counter is equal (and updated in this iteration), we can copy the result + counts_forward[And()] += m + counts_forward[CNOT()] += m # flip the final flag (flipped at most once) + + ### all counts + counts = Counter[Bloq]() + + # copy the index (controlled by the final flag) + counts[Xor(self.index_dtype).controlled()] += m + + # if nothing matched (final flag = 0), copy k and flip the flag bit + counts[Xor(self.index_dtype).controlled()] += 1 + counts[Xor(QBit())] += 1 + + for bloq, nb in counts_forward.items(): + # compute and uncompute all intermediate values. + counts[bloq] += nb + counts[bloq.adjoint()] += nb + + return counts + + +@bloq_example +def _col_kth_nz() -> ColumnOfKthNonZeroEntry: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import example_kxor_instance + + inst = example_kxor_instance() + ell = 8 + + col_kth_nz = ColumnOfKthNonZeroEntry(inst, ell) + return col_kth_nz + + +@bloq_example +def _col_kth_nz_symb() -> ColumnOfKthNonZeroEntry: + n, m, k, c, s = sympy.symbols("n m k c s", positive=True, integer=True) + inst = KXorInstance.symbolic(n=n, m=m, k=k) + ell = c * k + + col_kth_nz_symb = ColumnOfKthNonZeroEntry(inst, ell) + return col_kth_nz_symb + + +@frozen +class IndexOfNonZeroColumn(Bloq): + r"""Given $(S, T)$, compute $k$ such that $T$ is the $k$-th non-zero entry in row $S$. + + If $f(S, k)$ denotes the $k$-th non-zero entry in row $S$, + then this bloq maps $(S, f'(S, k), z, b)$ to $(S, f'(S, k), z \oplus k, b \oplus )$. + where $s$ is the sparsity, and $f'(S, k)$ is by extending $f$ + such that for all $k \ge s$, $f'(S, k) = k$. + Using $f'$ ensures the computation is reversible. + Note: we must use the same extension $f'$ for both oracles. + + This algorithm is described by the following pseudo-code: + ``` + def reverse(S, f_S_k) -> k: + nnz := 0 # counter + for j in range(\bar{m}): + T := S \Delta U_j + if |T| == l: + nnz := nnz + 1 + if T == f_S_k: + k ^= nnz + ``` + + Args: + inst: the kXOR instance $\mathcal{I}$. + ell: Kikuchi parameter $\ell$. + + Registers: + S: index register to store $S \in {[n] \choose \ell}$. + k: non-zero entry index register + """ + + inst: KXorInstance + ell: SymbolicInt + + @property + def signature(self) -> 'Signature': + return Signature( + [ + Register('S', self.index_dtype, shape=(self.ell,)), + Register('k', self.index_dtype, shape=(self.ell,)), + Register('T', self.index_dtype, shape=(self.ell,)), + Register('flag', QBit()), + ] + ) + + @property + def index_dtype(self) -> QUInt: + return QUInt(self.inst.index_bitsize) + + def adjoint(self) -> 'IndexOfNonZeroColumn': + return self + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> 'BloqCountDictT': + m = self.inst.num_unique_constraints + ell, k = self.ell, self.inst.k + + counts_forward = Counter[Bloq]() + + # compute symmetric differences for each constraint + counts_forward[SymmetricDifference(ell, k, ell, self.index_dtype)] += m + + # counter + counts_forward[AddK(self.index_dtype, 1).controlled()] += m + + # compare T to f_S_k each time + counts_forward[Equals(self.index_dtype)] += m + + # when T is equal (and counter is updated in this iteration), we can copy the result + counts_forward[And()] += m + counts_forward[CNOT()] += m # flip the final flag (flipped at most once) + + ### all counts + counts = Counter[Bloq]() + + # copy the value of nnz (when final flag = 1) + counts[Xor(self.index_dtype).controlled()] += m + + # if nothing matched (final flag = 0), copy k and flip the flag bit + counts[Xor(self.index_dtype).controlled()] += 1 + counts[Xor(QBit())] += 1 + + for bloq, nb in counts_forward.items(): + # compute and uncompute all intermediate values. + counts[bloq] += nb + counts[bloq.adjoint()] += nb + + return counts + + +@frozen +class KikuchiNonZeroIndex(Bloq): + r"""Adjacency list oracle $O_F$ for the Kikuchi matrix. + + The oracle $O_F$ (Definition 4.5) takes in $i, k$, + and outputs $i, f(i, k)$ where $f(i, k)$ is + index of the $k$-th non-zero entry in row $i$. + + As the Kikuchi matrix is symmetric, we can use the same oracle for both rows and columns. + + The Kikuchi matrix is indexed by $S \in {[n] \choose k}$. + For a given row $S$ and column $T$, the entry $\mathcal{K}_{k}_{S, T}$ + is potentially non-zero if $S \Delta T = U_j$ for some $j$, which is + equivalent to $T = S \Delta U_j$. + Here, $U_j$ is the $j$-th unique scope in the instance $\mathcal{I}$. + + To find the $k$-th non-zero entry, we use two oracles: + 1. $(S, k) \mapsto f(S, k)$, implemented by `ColumnOfKthNonZeroEntry` + 2. $(S, f(S, k)) \mapsto k$, implemented by `IndexOfNonZeroColumn`. + + Both these above oracles are unitary: they do not have any entangled ancilla/junk registers. + + + Note on sparsity: This bloq expects the user to provide the sparsity, as it is in general + difficult to compute the precise sparsity of the Kikuchi matrix efficiently. As long as the + provided number is at least the true sparsity, the algorithm will work as expected. + In case the provides sparsity is smaller, it is equivalent to making the remaining entries zero in the final block encoding. + + Args: + inst: the kXOR instance $\mathcal{I}$. + ell: Kikuchi parameter $\ell$. + s: sparsity, i.e. max number of non-zero entries in a row/column. + + Registers: + i: integer in [2^N] + k: integer in [2^N] + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Theorem 4.17, proof para 4 (top of page 39). + """ + + inst: KXorInstance + ell: SymbolicInt + s: SymbolicInt + + @property + def signature(self) -> 'Signature': + return Signature( + [ + Register('S', self.index_dtype, shape=(self.ell,)), + Register('k', self.index_dtype, shape=(self.ell,)), + ] + ) + + @property + def index_dtype(self) -> QUInt: + return QUInt(self.inst.index_bitsize) + + def build_composite_bloq( + self, bb: 'BloqBuilder', S: 'Soquet', k: 'Soquet' + ) -> dict[str, 'SoquetT']: + T = np.array([bb.allocate(dtype=self.index_dtype) for _ in range(int(self.ell))]) + flag = bb.add(ZeroState()) + S, k, T, flag = bb.add( + ColumnOfKthNonZeroEntry(self.inst, self.ell), S=S, k=k, T=T, flag=flag + ) + S, T, k, flag = bb.add(IndexOfNonZeroColumn(self.inst, self.ell), S=S, T=T, k=k, flag=flag) + for soq in k: + bb.free(soq) + bb.add(ZeroEffect(), q=flag) + return dict(S=S, k=T) + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> 'BloqCountDictT': + return { + ColumnOfKthNonZeroEntry(self.inst, self.ell): 1, + IndexOfNonZeroColumn(self.inst, self.ell): 1, + } + + +@bloq_example +def _kikuchi_nonzero_index() -> KikuchiNonZeroIndex: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import example_kxor_instance + + inst = example_kxor_instance() + ell = 8 + s = inst.brute_force_sparsity(ell) + + kikuchi_nonzero_index = KikuchiNonZeroIndex(inst, ell, s=s) + return kikuchi_nonzero_index + + +@bloq_example +def _kikuchi_nonzero_index_symb() -> KikuchiNonZeroIndex: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import KXorInstance + + n, m, k, c, s = sympy.symbols("n m k c s", positive=True, integer=True) + inst = KXorInstance.symbolic(n=n, m=m, k=k) + ell = c * k + + kikuchi_nonzero_index_symb = KikuchiNonZeroIndex(inst, ell, s=s) + return kikuchi_nonzero_index_symb + + +_KIKUCHI_NONZERO_INDEX_DOC = BloqDocSpec( + bloq_cls=KikuchiNonZeroIndex, examples=[_kikuchi_nonzero_index] +) diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list_test.py b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list_test.py new file mode 100644 index 000000000..fd6875bdf --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_list_test.py @@ -0,0 +1,78 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from unittest.mock import ANY + +import pytest +import sympy + +import qualtran.testing as qlt_testing +from qualtran.resource_counting import big_O, GateCounts, get_cost_value, QECGatesCost +from qualtran.symbolics import ceil, log2 + +from .kikuchi_adjacency_list import ( + _col_kth_nz, + _col_kth_nz_symb, + _kikuchi_nonzero_index, + _kikuchi_nonzero_index_symb, +) + + +@pytest.mark.parametrize( + "bloq_ex", + [_col_kth_nz, _col_kth_nz_symb, _kikuchi_nonzero_index, _kikuchi_nonzero_index_symb], + ids=lambda bloq_ex: bloq_ex.name, +) +def test_examples(bloq_autotester, bloq_ex): + if bloq_autotester.check_name == 'serialize': + pytest.skip() + + bloq_autotester(bloq_ex) + + +def test_cost_col_kth_nz(): + n, m, k, c, s = sympy.symbols("n m k c s", positive=True, integer=True) + l = c * k + logn = ceil(log2(n)) + logl = ceil(log2(l)) + + bloq = _col_kth_nz_symb() + cost = get_cost_value(bloq, QECGatesCost()) + assert cost == GateCounts( + toffoli=(m + 1) * logn, + cswap=4 * l * m * (logl + 1) * logn, + and_bloq=( + 4 * m * (logn - 1) + + ( + 2 + * m + * ( + 2 * l * ((2 * logn + 1) * (logl + 1)) + + l + + k + + 2 * ((logn - 1) * (l + k - 1)) + + 2 * ceil(log2(l + k)) + - 4 + ) + ) + + m + ), + clifford=ANY, + measurement=ANY, + ) + assert big_O(cost.total_t_count()) == big_O(l * m * logn * logl) + + +@pytest.mark.notebook +def test_notebook(): + qlt_testing.execute_notebook('kikuchi_adjacency_list') diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix.ipynb b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix.ipynb new file mode 100644 index 000000000..599e88a21 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix.ipynb @@ -0,0 +1,197 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "f82c4ce3", + "metadata": { + "cq.autogen": "title_cell" + }, + "source": [ + "# Planted Noisy kXOR: Kikuchi Adjacency Matrix" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8910a435", + "metadata": { + "cq.autogen": "top_imports" + }, + "outputs": [], + "source": [ + "from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", + "from qualtran import QBit, QInt, QUInt, QAny\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", + "from typing import *\n", + "import numpy as np\n", + "import sympy\n", + "import cirq" + ] + }, + { + "cell_type": "markdown", + "id": "3702603c", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.bloq_doc.md" + }, + "source": [ + "## `KikuchiMatrixEntry`\n", + "Adjacency matrix oracle for the Kikuchi matrix.\n", + "\n", + "Given a kXOR instance $\\mathcal{I}$ with $n$ variables, $m$ constraints,\n", + "the Kikuchi matrix with parameter $\\ell$ is indexed by ${[n] \\choose l}$.\n", + "For $S, T \\in {[n] \\choose l}$, the entry is given by\n", + "$H_{S, T} = B_{\\mathcal{I}}(S \\Delta T)/M$, where $M$ is the max entry.\n", + "\n", + "This bloq implements the transform:\n", + " $$\n", + " |0 \\rangle |S\\rangle |T\\rangle\n", + " \\mapsto\n", + " (\\sqrt{H_{S, T}}|0\\rangle + \\sqrt{1 - |H_{S, T}|}|1\\rangle)|S\\rangle |T\\rangle\n", + " $$\n", + "\n", + "This is equivalent to $O_H$ (Def. 4.3) from the paper, but is optimized to classically\n", + "compute the `arccos` of the entries, and directly apply the rotation,\n", + "instead of computing them using a quantum circuit.\n", + "\n", + "This bloq performs the following steps\n", + "1. Compute the symmetric difference $D = S \\Delta T$.\n", + "2. Compute the index $j$ s.t. $U_j = D$ (where $U_j$ are a list of unique scopes)\n", + "4. Apply a controlled Y-rotation with angle for the $j$-th entry.\n", + "5. Uncompute steps 3, 2, 1.\n", + "\n", + "#### Parameters\n", + " - `inst`: k-XOR instance\n", + " - `ell`: the Kikuchi parameter $\\ell$, must be a multiple of $k$.\n", + " - `entry_bitsize`: number of bits to approximate each rotation angle to.\n", + " - `cv`: single bit control value (0 or 1), or None for uncontrolled (default). \n", + "\n", + "#### Registers\n", + " - `S`: row index\n", + " - `T`: column index\n", + " - `q`: the qubit to rotate by $Ry(2 \\arccos(\\sqrt{H_{S,T} / M}))$ as defined above. \n", + "\n", + "#### References\n", + " - [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1). Definition 4.3. Theorem 4.17 para 3.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "06c85c6c", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.bloq_doc.py" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat import KikuchiMatrixEntry" + ] + }, + { + "cell_type": "markdown", + "id": "f45d82af", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.example_instances.md" + }, + "source": [ + "### Example Instances" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e5a5035e", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.kikuchi_matrix_entry_symb" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import KXorInstance\n", + "\n", + "n, m, k, c = sympy.symbols(\"n m k c\", positive=True, integer=True)\n", + "inst = KXorInstance.symbolic(n=n, m=m, k=k)\n", + "ell = c * k\n", + "\n", + "kikuchi_matrix_entry_symb = KikuchiMatrixEntry(inst, ell, entry_bitsize=3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "802ff581", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.kikuchi_matrix_entry" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import example_kxor_instance\n", + "\n", + "inst = example_kxor_instance()\n", + "ell = 8\n", + "\n", + "kikuchi_matrix_entry = KikuchiMatrixEntry(inst, ell, entry_bitsize=3)" + ] + }, + { + "cell_type": "markdown", + "id": "fd2fd175", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.graphical_signature.md" + }, + "source": [ + "#### Graphical Signature" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5d9b2e3a", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.graphical_signature.py" + }, + "outputs": [], + "source": [ + "from qualtran.drawing import show_bloqs\n", + "show_bloqs([kikuchi_matrix_entry_symb, kikuchi_matrix_entry],\n", + " ['`kikuchi_matrix_entry_symb`', '`kikuchi_matrix_entry`'])" + ] + }, + { + "cell_type": "markdown", + "id": "649be2c9", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.call_graph.md" + }, + "source": [ + "### Call Graph" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a901dca4", + "metadata": { + "cq.autogen": "KikuchiMatrixEntry.call_graph.py" + }, + "outputs": [], + "source": [ + "from qualtran.resource_counting.generalizers import ignore_split_join\n", + "kikuchi_matrix_entry_symb_g, kikuchi_matrix_entry_symb_sigma = kikuchi_matrix_entry_symb.call_graph(max_depth=1, generalizer=ignore_split_join)\n", + "show_call_graph(kikuchi_matrix_entry_symb_g)\n", + "show_counts_sigma(kikuchi_matrix_entry_symb_sigma)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix.py b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix.py new file mode 100644 index 000000000..c198e7800 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix.py @@ -0,0 +1,184 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from collections import Counter +from functools import cached_property + +import attrs +import sympy +from attrs import frozen + +from qualtran import ( + AddControlledT, + Bloq, + bloq_example, + BloqDocSpec, + CtrlSpec, + QAny, + QBit, + QFxp, + QUInt, + Signature, +) +from qualtran.bloqs.arithmetic.lists import SymmetricDifference +from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator +from qualtran.symbolics import SymbolicInt + +from .kxor_instance import KXorInstance +from .load_kxor_instance import LoadUniqueScopeIndex, PRGAUniqueConstraintRHS + + +@frozen +class KikuchiMatrixEntry(Bloq): + r"""Adjacency matrix oracle for the Kikuchi matrix. + + Given a kXOR instance $\mathcal{I}$ with $n$ variables, $m$ constraints, + the Kikuchi matrix with parameter $\ell$ is indexed by ${[n] \choose l}$. + For $S, T \in {[n] \choose l}$, the entry is given by + $H_{S, T} = B_{\mathcal{I}}(S \Delta T)/M$, where $M$ is the max entry. + + This bloq implements the transform: + $$ + |0 \rangle |S\rangle |T\rangle + \mapsto + (\sqrt{H_{S, T}}|0\rangle + \sqrt{1 - |H_{S, T}|}|1\rangle)|S\rangle |T\rangle + $$ + + This is equivalent to $O_H$ (Def. 4.3) from the paper, but is optimized to classically + compute the `arccos` of the entries, and directly apply the rotation, + instead of computing them using a quantum circuit. + + This bloq performs the following steps + 1. Compute the symmetric difference $D = S \Delta T$. + 2. Compute the index $j$ s.t. $U_j = D$ (where $U_j$ are a list of unique scopes) + 4. Apply a controlled Y-rotation with angle for the $j$-th entry. + 5. Uncompute steps 3, 2, 1. + + Args: + inst: k-XOR instance + ell: the Kikuchi parameter $\ell$, must be a multiple of $k$. + entry_bitsize: number of bits to approximate each rotation angle to. + cv: single bit control value (0 or 1), or None for uncontrolled (default). + + Registers: + S: row index + T: column index + q: the qubit to rotate by $Ry(2 \arccos(\sqrt{H_{S,T} / M}))$ as defined above. + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Definition 4.3. Theorem 4.17 para 3. + """ + + inst: KXorInstance + ell: SymbolicInt + entry_bitsize: SymbolicInt + is_controlled: bool = False + + @property + def signature(self) -> 'Signature': + return Signature.build_from_dtypes( + ctrl=QAny(1 if self.is_controlled else 0), + S=QAny(self.composite_index_bitsize), + T=QAny(self.composite_index_bitsize), + q=QBit(), + ) + + @cached_property + def index_dtype(self) -> QUInt: + return QUInt(self.inst.index_bitsize) + + @cached_property + def composite_index_bitsize(self) -> SymbolicInt: + """total number of bits to store `l` indices in `[n]`.""" + return self.ell * self.inst.index_bitsize + + @cached_property + def rotation_angle_dtype(self): + return QFxp(self.entry_bitsize, self.entry_bitsize) + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: + counts = Counter[Bloq]() + + # S \Delta T + symm_diff = SymmetricDifference(self.ell, self.ell, self.inst.k, self.index_dtype) + counts[symm_diff] += 1 + counts[symm_diff.adjoint()] += 1 + + # Map S to j, such that U_j = S + load_idx = LoadUniqueScopeIndex(self.inst) + counts[load_idx] += 1 + counts[load_idx.adjoint()] += 1 + + # apply the rotation + rotation: Bloq = PRGAUniqueConstraintRHS(self.inst, self.entry_bitsize) + if self.is_controlled: + rotation = rotation.controlled() + counts[rotation] += 1 + + return counts + + def get_ctrl_system(self, ctrl_spec: 'CtrlSpec') -> tuple['Bloq', 'AddControlledT']: + from qualtran.bloqs.mcmt.specialized_ctrl import get_ctrl_system_1bit_cv_from_bloqs + + ctrl_bit, ctrl_bloq = ( + (1, self) if self.is_controlled else (None, attrs.evolve(self, is_controlled=True)) + ) + + return get_ctrl_system_1bit_cv_from_bloqs( + self, + ctrl_spec, + current_ctrl_bit=ctrl_bit, + bloq_with_ctrl=ctrl_bloq, + ctrl_reg_name='ctrl', + ) + + +@bloq_example +def _kikuchi_matrix_entry() -> KikuchiMatrixEntry: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import example_kxor_instance + + inst = example_kxor_instance() + ell = 8 + + kikuchi_matrix_entry = KikuchiMatrixEntry(inst, ell, entry_bitsize=3) + return kikuchi_matrix_entry + + +@bloq_example +def _kikuchi_matrix_entry_symb() -> KikuchiMatrixEntry: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import KXorInstance + + n, m, k, c = sympy.symbols("n m k c", positive=True, integer=True) + inst = KXorInstance.symbolic(n=n, m=m, k=k) + ell = c * k + + kikuchi_matrix_entry_symb = KikuchiMatrixEntry(inst, ell, entry_bitsize=3) + return kikuchi_matrix_entry_symb + + +_KIKUCHI_MATRIX_ENTRY_DOC = BloqDocSpec( + bloq_cls=KikuchiMatrixEntry, examples=[_kikuchi_matrix_entry_symb, _kikuchi_matrix_entry] +) diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix_test.py b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix_test.py new file mode 100644 index 000000000..6159296be --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_adjacency_matrix_test.py @@ -0,0 +1,93 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from unittest.mock import ANY + +import pytest +import sympy +from attrs import evolve + +import qualtran.testing as qlt_testing +from qualtran.resource_counting import big_O, GateCounts, get_cost_value, QECGatesCost +from qualtran.symbolics import ceil, log2 + +from .kikuchi_adjacency_matrix import _kikuchi_matrix_entry, _kikuchi_matrix_entry_symb + + +@pytest.mark.parametrize("bloq_ex", [_kikuchi_matrix_entry, _kikuchi_matrix_entry_symb]) +def test_examples(bloq_autotester, bloq_ex): + if bloq_autotester.check_name == 'serialize': + pytest.skip() + + bloq_autotester(bloq_ex) + + +def test_controlled_cost(): + bloq = _kikuchi_matrix_entry() + _, sigma = bloq.call_graph(max_depth=2) + _, ctrl_sigma = bloq.controlled().call_graph(max_depth=2) + + # should only differ in QROM call for loading absolute amplitudes + a_minus_b = set(sigma.items()) - set(ctrl_sigma.items()) + b_minus_a = set(ctrl_sigma.items()) - set(sigma.items()) + assert len(a_minus_b) == 1 + assert len(b_minus_a) == 1 + + ((qrom, na),) = a_minus_b + ((ctrl_qrom, nb),) = b_minus_a + assert na == nb + assert evolve(qrom, num_controls=1) == ctrl_qrom # type: ignore + + +def test_cost(): + bloq = _kikuchi_matrix_entry() + + gc = get_cost_value(bloq, QECGatesCost()) + assert gc == GateCounts( + cswap=512, and_bloq=1301, clifford=12518, measurement=1301, rotation=ANY + ) + + +def test_cost_symb(): + bloq = _kikuchi_matrix_entry_symb() + n, m, k, c = sympy.symbols("n m k c", positive=True, integer=True) + + l = c * k + logl = ceil(log2(l)) + logn = ceil(log2(n)) + logm = ceil(log2(m)) + + gc = get_cost_value(bloq, QECGatesCost()) + assert gc == GateCounts( + cswap=4 * l * (logl + 1) * logn, + and_bloq=( + 4 * l * ((2 * logn + 1) * (logl + 1)) + + 4 * l + + 2 * m * (k * logn - 1) + + 2 * m + + 4 * ((2 * l - 1) * (logn - 1)) + + logm + + 4 * ceil(log2(2 * l)) + - 10 + ), + rotation=ANY, + clifford=ANY, + measurement=ANY, + ) + + assert big_O(gc.total_t_count()) == big_O(l * logn * logl + k * m * logn) + + +@pytest.mark.notebook +def test_notebook(): + qlt_testing.execute_notebook('kikuchi_adjacency_matrix') diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding.ipynb b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding.ipynb new file mode 100644 index 000000000..f230ac0ab --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding.ipynb @@ -0,0 +1,183 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e1597556", + "metadata": { + "cq.autogen": "title_cell" + }, + "source": [ + "# Noisy kXOR: Block-encoding the Kikuchi Matrix\n", + "\n", + "Section 4.4.2 Simulating the Kikuchi Hamiltonian\n", + "\n", + "This module contains oracles to implement the block-encoding of the Kikuchi\n", + "Hamiltonian corresponding to an input k-XOR-SAT instance.\n", + "\n", + "References:\n", + " [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1)\n", + " Section 4.4.2 for algorithm. Section 2.4 for definitions and notation." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8d69b0bd", + "metadata": { + "cq.autogen": "top_imports" + }, + "outputs": [], + "source": [ + "from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", + "from qualtran import QBit, QInt, QUInt, QAny\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", + "from typing import *\n", + "import numpy as np\n", + "import sympy\n", + "import cirq" + ] + }, + { + "cell_type": "markdown", + "id": "4e549ab8", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.bloq_doc.md" + }, + "source": [ + "## `KikuchiHamiltonian`\n", + "Block encoding of the Kikuchi matrix $\\mathcal{K}_\\ell$.\n", + "\n", + "This is implemented by a sparse matrix block encoding using the adjacency matrix\n", + "and adjacency list oracles.\n", + "\n", + "This assumes a default sparsity of $\\bar{m}$, which is the number of unique\n", + "scopes in the instance $\\mathcal{I}$.\n", + "If a better bound on sparsity is known, it can be passed in by the user.\n", + "\n", + "#### Parameters\n", + " - `inst`: kXOR instance $\\mathcal{I}$.\n", + " - `ell`: Kikuchi parameter $\\ell$.\n", + " - `entry_bitsize`: Number of bits $b$ to approximate the matrix entries (angles) to.\n", + " - `s`: sparsity of the Kikuchi matrix, defaults to $\\bar{m}$.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a89ce06", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.bloq_doc.py" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat import KikuchiHamiltonian" + ] + }, + { + "cell_type": "markdown", + "id": "9b0195ad", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.example_instances.md" + }, + "source": [ + "### Example Instances" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8660eb37", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.kikuchi_matrix" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import example_kxor_instance\n", + "\n", + "inst = example_kxor_instance()\n", + "ell = 8\n", + "\n", + "kikuchi_matrix = KikuchiHamiltonian(inst, ell)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f6f324e", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.kikuchi_matrix_symb" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import KXorInstance\n", + "\n", + "n, m, k, c = sympy.symbols(\"n m k c\", positive=True, integer=True)\n", + "inst = KXorInstance.symbolic(n=n, m=m, k=k)\n", + "ell = c * k\n", + "\n", + "kikuchi_matrix_symb = KikuchiHamiltonian(inst, ell)" + ] + }, + { + "cell_type": "markdown", + "id": "312f1765", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.graphical_signature.md" + }, + "source": [ + "#### Graphical Signature" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1419c085", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.graphical_signature.py" + }, + "outputs": [], + "source": [ + "from qualtran.drawing import show_bloqs\n", + "show_bloqs([kikuchi_matrix, kikuchi_matrix_symb],\n", + " ['`kikuchi_matrix`', '`kikuchi_matrix_symb`'])" + ] + }, + { + "cell_type": "markdown", + "id": "720f08a4", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.call_graph.md" + }, + "source": [ + "### Call Graph" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c492110d", + "metadata": { + "cq.autogen": "KikuchiHamiltonian.call_graph.py" + }, + "outputs": [], + "source": [ + "from qualtran.resource_counting.generalizers import ignore_split_join\n", + "kikuchi_matrix_g, kikuchi_matrix_sigma = kikuchi_matrix.call_graph(max_depth=1, generalizer=ignore_split_join)\n", + "show_call_graph(kikuchi_matrix_g)\n", + "show_counts_sigma(kikuchi_matrix_sigma)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding.py b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding.py new file mode 100644 index 000000000..3862563fb --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding.py @@ -0,0 +1,236 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Section 4.4.2 Simulating the Kikuchi Hamiltonian + +This module contains oracles to implement the block-encoding of the Kikuchi +Hamiltonian corresponding to an input k-XOR-SAT instance. + +References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Section 4.4.2 for algorithm. Section 2.4 for definitions and notation. +""" +from functools import cached_property + +import sympy +from attrs import field, frozen + +from qualtran import ( + bloq_example, + BloqBuilder, + BloqDocSpec, + BQUInt, + QAny, + QBit, + QUInt, + Signature, + Soquet, + SoquetT, +) +from qualtran.bloqs.block_encoding import BlockEncoding +from qualtran.bloqs.block_encoding.sparse_matrix import RowColumnOracle +from qualtran.bloqs.block_encoding.sparse_matrix_hermitian import ( + SparseMatrixHermitian, + SqrtEntryOracle, +) +from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare +from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator +from qualtran.symbolics import is_symbolic, SymbolicFloat, SymbolicInt + +from .kikuchi_adjacency_list import KikuchiNonZeroIndex +from .kikuchi_adjacency_matrix import KikuchiMatrixEntry +from .kxor_instance import KXorInstance + + +@frozen +class BlackBoxKikuchiEntryOracle(SqrtEntryOracle): + r"""Wrapper around the adjacency matrix oracle $O_H$ of the Kikuchi graph.""" + + O_H: KikuchiMatrixEntry + + @cached_property + def signature(self) -> Signature: + return Signature.build_from_dtypes( + q=QBit(), i=QAny(self.system_bitsize), j=QAny(self.system_bitsize) + ) + + @property + def system_bitsize(self) -> SymbolicInt: + return self.O_H.composite_index_bitsize + + @property + def epsilon(self) -> SymbolicFloat: + """precision due to fixed-point approximation of entries. + + In the good case, whp (i.e. 1 - o(1)), the entries are in [-2, 2], + whose corresponding angles can be represented exactly with 3 bits. + I.e. `arccos(sqrt(x / 2)) / pi` for `x in [-2, 2]` are `2, 1.5, 1, 0.5, 0`. + """ + return 0 + + @property + def _phasegrad_bitsize(self) -> SymbolicInt: + return self.O_H.entry_bitsize + + def build_composite_bloq( + self, bb: 'BloqBuilder', q: 'Soquet', i: 'Soquet', j: 'Soquet' + ) -> dict[str, 'SoquetT']: + i, j, q = bb.add(self.O_H, S=i, T=j, q=q) + return dict(q=q, i=i, j=j) + + +@frozen +class BlackBoxKikuchiRowColumnOracle(RowColumnOracle): + r"""Wrapper around the adjacency list oracle $O_F$ of the Kikuchi graph.""" + + O_F: KikuchiNonZeroIndex + + @cached_property + def signature(self) -> Signature: + return Signature.build_from_dtypes( + l=BQUInt(self.system_bitsize, self.num_nonzero), i=QUInt(self.system_bitsize) + ) + + @property + def system_bitsize(self) -> SymbolicInt: + return self.O_F.index_dtype.num_qubits * self.O_F.ell + + @property + def num_nonzero(self) -> SymbolicInt: + return self.O_F.s + + def build_composite_bloq( + self, bb: 'BloqBuilder', l: 'Soquet', i: 'Soquet' + ) -> dict[str, 'SoquetT']: + i, l = bb.add(self.O_F, S=i, k=l) + return dict(l=l, i=i) + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> 'BloqCountDictT': + return {self.O_F: 1} + + +@frozen +class KikuchiHamiltonian(BlockEncoding): + r"""Block encoding of the Kikuchi matrix $\mathcal{K}_\ell$. + + This is implemented by a sparse matrix block encoding using the adjacency matrix + and adjacency list oracles. + + This assumes a default sparsity of $\bar{m}$, which is the number of unique + scopes in the instance $\mathcal{I}$. + If a better bound on sparsity is known, it can be passed in by the user. + + Args: + inst: kXOR instance $\mathcal{I}$. + ell: Kikuchi parameter $\ell$. + entry_bitsize: Number of bits $b$ to approximate the matrix entries (angles) to. + s: sparsity of the Kikuchi matrix, defaults to $\bar{m}$. + """ + + inst: KXorInstance + ell: SymbolicInt + entry_bitsize: SymbolicInt = field() + s: SymbolicInt = field() + + @s.default + def _default_sparsity(self) -> SymbolicInt: + return self.inst.num_unique_constraints + + @entry_bitsize.default + def _default_entry_bitsize(self): + if is_symbolic(self.inst.max_rhs) or self.inst.max_rhs == 2: + # one T gate suffices! + return 3 + raise ValueError("Entries outside range [-2, 2], please specify an explicit entry_bitsize.") + + @cached_property + def signature(self) -> 'Signature': + return Signature.build( + system=self.system_bitsize, ancilla=self.ancilla_bitsize, resource=self.resource_bitsize + ) + + @cached_property + def _sparse_matrix_encoding(self) -> SparseMatrixHermitian: + blackbox_O_F = BlackBoxKikuchiRowColumnOracle(self.oracle_O_F) + blackbox_O_H = BlackBoxKikuchiEntryOracle(self.oracle_O_H) + return SparseMatrixHermitian( + col_oracle=blackbox_O_F, entry_oracle=blackbox_O_H, eps=blackbox_O_H.epsilon + ) + + @cached_property + def oracle_O_H(self) -> KikuchiMatrixEntry: + r"""Maps $|i, j\rangle |0\rangle$ to $|i, j\rangle (\sqrt{A_{ij}} |0\rangle + \sqrt{1 - |A_{ij}|} |1\rangle)""" + return KikuchiMatrixEntry(inst=self.inst, ell=self.ell, entry_bitsize=self.entry_bitsize) + + @cached_property + def oracle_O_F(self) -> KikuchiNonZeroIndex: + r"""Maps `i, k` to `i, f(i, k)` where `f(i, k)` is the column of the `k`-th nonzero entry in row `i`.""" + return KikuchiNonZeroIndex(inst=self.inst, ell=self.ell, s=self.s) + + @property + def alpha(self) -> SymbolicFloat: + return self._sparse_matrix_encoding.alpha + + @property + def system_bitsize(self) -> SymbolicInt: + return self._sparse_matrix_encoding.system_bitsize + + @property + def ancilla_bitsize(self) -> SymbolicInt: + return self._sparse_matrix_encoding.ancilla_bitsize + + @property + def resource_bitsize(self) -> SymbolicInt: + return self._sparse_matrix_encoding.resource_bitsize + + @property + def epsilon(self) -> SymbolicFloat: + return self._sparse_matrix_encoding.epsilon + + @property + def signal_state(self) -> BlackBoxPrepare: + return self._sparse_matrix_encoding.signal_state + + def build_composite_bloq(self, bb: 'BloqBuilder', **soqs: 'SoquetT') -> dict[str, 'SoquetT']: + return bb.add_d(self._sparse_matrix_encoding, **soqs) + + def __str__(self): + return 'B[K_l]' + + +@bloq_example +def _kikuchi_matrix() -> KikuchiHamiltonian: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import example_kxor_instance + + inst = example_kxor_instance() + ell = 8 + + kikuchi_matrix = KikuchiHamiltonian(inst, ell) + return kikuchi_matrix + + +@bloq_example +def _kikuchi_matrix_symb() -> KikuchiHamiltonian: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import KXorInstance + + n, m, k, c = sympy.symbols("n m k c", positive=True, integer=True) + inst = KXorInstance.symbolic(n=n, m=m, k=k) + ell = c * k + + kikuchi_matrix_symb = KikuchiHamiltonian(inst, ell) + return kikuchi_matrix_symb + + +_KIKUCHI_HAMILTONIAN_DOC = BloqDocSpec( + bloq_cls=KikuchiHamiltonian, examples=[_kikuchi_matrix, _kikuchi_matrix_symb] +) diff --git a/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding_test.py b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding_test.py new file mode 100644 index 000000000..ad8ef0951 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/kikuchi_block_encoding_test.py @@ -0,0 +1,58 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import pytest + +import qualtran.testing as qlt_testing +from qualtran.bloqs.basic_gates import Swap +from qualtran.resource_counting import get_cost_value, QECGatesCost + +from .kikuchi_block_encoding import _kikuchi_matrix, _kikuchi_matrix_symb + + +@pytest.mark.parametrize("bloq_ex", [_kikuchi_matrix, _kikuchi_matrix_symb]) +def test_examples(bloq_autotester, bloq_ex): + if bloq_autotester.check_name == 'serialize': + pytest.skip() + + bloq_autotester(bloq_ex) + + +@pytest.mark.notebook +def test_notebook(): + qlt_testing.execute_notebook('kikuchi_block_encoding') + + +def test_controlled_cost(): + bloq = _kikuchi_matrix() + _, sigma = bloq.call_graph(max_depth=2) + _, ctrl_sigma = bloq.controlled().call_graph(max_depth=2) + + assert set(sigma.items()) - set(ctrl_sigma.items()) == {(Swap(32), 1), (Swap(1), 1)} + assert set(ctrl_sigma.items()) - set(sigma.items()) == { + (Swap(32).controlled(), 1), + (Swap(1).controlled(), 1), + } + + +def test_cost(): + bloq = _kikuchi_matrix() + + _ = get_cost_value(bloq, QECGatesCost()) + + +def test_cost_symb(): + bloq = _kikuchi_matrix_symb() + + _ = get_cost_value(bloq, QECGatesCost()) + print(_) diff --git a/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance.ipynb b/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance.ipynb new file mode 100644 index 000000000..7987d624e --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance.ipynb @@ -0,0 +1,207 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "448cdbc3", + "metadata": { + "cq.autogen": "title_cell" + }, + "source": [ + "# kXOR: Instance load Oracles\n", + "\n", + "We define three oracles that load a kXOR instance, which are used in the algorithm.\n", + "\n", + "We are given a kXOR instance $\\mathcal{I}$ of $n$ variables,\n", + "with $\\bar{m}$ unique scopes $\\{U_j | j \\in [\\bar{m}]\\}$.\n", + "We provide oracles to:\n", + "1. `LoadConstraintScopes`: Given $j \\in [\\bar{m}]$, compute $U_j$.\n", + "2. `LoadUniqueScopeIndex`: Given $U_j$, compute $j \\in [\\bar{m}]$\n", + "3. `PRGAUniqueConstraintRHS` Given $j$, apply $Rx(arccos(\\sqrt{B_\\mathcal{I}(S)/M}))$ on a target qubit.\n", + "(for an appropriate normalization $M$).\n", + "\n", + "\n", + "The first two oracles are independent of the RHS.\n", + "All these oracles can output arbitrary values for invalid inputs.\n", + "\n", + "References:\n", + " [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1)\n", + " Notation 2.24 for $B_\\mathcal{I}$.\n", + " Theorem 4.17, proof para 2 for $U_j$." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "611e4ef6", + "metadata": { + "cq.autogen": "top_imports" + }, + "outputs": [], + "source": [ + "from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", + "from qualtran import QBit, QInt, QUInt, QAny\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", + "from typing import *\n", + "import numpy as np\n", + "import sympy\n", + "import cirq" + ] + }, + { + "cell_type": "markdown", + "id": "b5e118d0", + "metadata": { + "cq.autogen": "LoadConstraintScopes.bloq_doc.md" + }, + "source": [ + "## `LoadConstraintScopes`\n", + "Given an index $j$, load the scope of the $j$-th unique constraint.\n", + "\n", + "Given a $k$-XOR-SAT instance `inst` with $n$ variables and $m$ constraints.\n", + "Assuming `inst` has $\\bar{m}$ unique constraints, we define $U_j \\in {[n] \\choose k}$\n", + "for $j \\in [\\bar{m}]$ as the $j$-th unique constraint scope.\n", + "\n", + "The scopes are loaded using a QROM.\n", + "\n", + "If the input contains an invalid index, then any arbitrary value can be output.\n", + "\n", + "#### Registers\n", + " - `j`: a number in [\\bar{m}]\n", + " - `U`: $j$-th unique scope\n", + " - `ancilla`: entangled intermediate qubits, to be uncomputed by the adjoint. \n", + "\n", + "#### References\n", + " - [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1). Theorem 4.17, proof para 2.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "51cbd971", + "metadata": { + "cq.autogen": "LoadConstraintScopes.bloq_doc.py" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat import LoadConstraintScopes" + ] + }, + { + "cell_type": "markdown", + "id": "45f7354e", + "metadata": { + "cq.autogen": "LoadConstraintScopes.example_instances.md" + }, + "source": [ + "### Example Instances" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "137d0cb6", + "metadata": { + "cq.autogen": "LoadConstraintScopes.load_scopes_symb" + }, + "outputs": [], + "source": [ + "import sympy\n", + "\n", + "from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import KXorInstance\n", + "\n", + "n, m, k = sympy.symbols(\"n m k\", positive=True, integer=True)\n", + "inst = KXorInstance.symbolic(n=n, m=m, k=k)\n", + "load_scopes_symb = LoadConstraintScopes(inst)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d1a93c7c", + "metadata": { + "cq.autogen": "LoadConstraintScopes.load_scopes" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import Constraint, KXorInstance\n", + "\n", + "inst = KXorInstance(\n", + " n=6,\n", + " k=4,\n", + " constraints=(\n", + " Constraint(S=(0, 1, 2, 3), b=1),\n", + " Constraint(S=(0, 1, 4, 5), b=-1),\n", + " Constraint(S=(1, 2, 4, 5), b=1),\n", + " Constraint(S=(0, 3, 4, 5), b=1),\n", + " Constraint(S=(2, 3, 4, 5), b=1),\n", + " Constraint(S=(0, 1, 2, 3), b=1),\n", + " Constraint(S=(0, 3, 4, 5), b=1),\n", + " Constraint(S=(2, 3, 4, 5), b=1),\n", + " ),\n", + ")\n", + "load_scopes = LoadConstraintScopes(inst)" + ] + }, + { + "cell_type": "markdown", + "id": "107c977f", + "metadata": { + "cq.autogen": "LoadConstraintScopes.graphical_signature.md" + }, + "source": [ + "#### Graphical Signature" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3a998692", + "metadata": { + "cq.autogen": "LoadConstraintScopes.graphical_signature.py" + }, + "outputs": [], + "source": [ + "from qualtran.drawing import show_bloqs\n", + "show_bloqs([load_scopes_symb, load_scopes],\n", + " ['`load_scopes_symb`', '`load_scopes`'])" + ] + }, + { + "cell_type": "markdown", + "id": "8b3ac93d", + "metadata": { + "cq.autogen": "LoadConstraintScopes.call_graph.md" + }, + "source": [ + "### Call Graph" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "29b2841a", + "metadata": { + "cq.autogen": "LoadConstraintScopes.call_graph.py" + }, + "outputs": [], + "source": [ + "from qualtran.resource_counting.generalizers import ignore_split_join\n", + "load_scopes_symb_g, load_scopes_symb_sigma = load_scopes_symb.call_graph(max_depth=1, generalizer=ignore_split_join)\n", + "show_call_graph(load_scopes_symb_g)\n", + "show_counts_sigma(load_scopes_symb_sigma)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance.py b/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance.py new file mode 100644 index 000000000..3d379f974 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance.py @@ -0,0 +1,354 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +r"""We define three oracles that load a kXOR instance, which are used in the algorithm. + +We are given a kXOR instance $\mathcal{I}$ of $n$ variables, +with $\bar{m}$ unique scopes $\{U_j | j \in [\bar{m}]\}$. +We provide oracles to: +1. `LoadConstraintScopes`: Given $j \in [\bar{m}]$, compute $U_j$. +2. `LoadUniqueScopeIndex`: Given $U_j$, compute $j \in [\bar{m}]$ +3. `PRGAUniqueConstraintRHS` Given $j$, apply $Rx(arccos(\sqrt{B_\mathcal{I}(S)/M}))$ on a target qubit. +(for an appropriate normalization $M$). + + +The first two oracles are independent of the RHS. +All these oracles can output arbitrary values for invalid inputs. + +References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Notation 2.24 for $B_\mathcal{I}$. + Theorem 4.17, proof para 2 for $U_j$. +""" +from functools import cached_property +from typing import Counter, Sequence, Union + +import attrs +import numpy as np +from attrs import frozen + +from qualtran import ( + AddControlledT, + Bloq, + bloq_example, + BloqBuilder, + BloqDocSpec, + BQUInt, + CtrlSpec, + DecomposeTypeError, + QAny, + QBit, + QFxp, + Register, + Side, + Signature, + Soquet, + SoquetT, +) +from qualtran.bloqs.arithmetic import EqualsAConstant, LessThanConstant +from qualtran.bloqs.basic_gates import Hadamard, SGate +from qualtran.bloqs.bookkeeping import Partition +from qualtran.bloqs.data_loading import QROM +from qualtran.bloqs.rotations.rz_via_phase_gradient import RzViaPhaseGradient +from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator +from qualtran.symbolics import ceil, HasLength, is_symbolic, is_zero, log2, SymbolicInt + +from .kxor_instance import KXorInstance + + +@frozen +class LoadConstraintScopes(Bloq): + r"""Given an index $j$, load the scope of the $j$-th unique constraint. + + Given a $k$-XOR-SAT instance `inst` with $n$ variables and $m$ constraints. + Assuming `inst` has $\bar{m}$ unique constraints, we define $U_j \in {[n] \choose k}$ + for $j \in [\bar{m}]$ as the $j$-th unique constraint scope. + + The scopes are loaded using a QROM. + + If the input contains an invalid index, then any arbitrary value can be output. + + Registers: + j: a number in [\bar{m}] + U (RIGHT): $j$-th unique scope + ancilla (RIGHT): entangled intermediate qubits, to be uncomputed by the adjoint. + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Theorem 4.17, proof para 2. + """ + + inst: KXorInstance + + @cached_property + def signature(self) -> 'Signature': + registers: list[Register] = [ + Register('j', self.m_dtype), + Register('U', QAny(self.scope_bitsize), side=Side.RIGHT), + ] + + if not is_zero(self.ancilla_bitsize): + registers.append(Register('ancilla', QAny(self.ancilla_bitsize), side=Side.RIGHT)) + + return Signature(registers) + + @cached_property + def scope_bitsize(self) -> SymbolicInt: + """total number of bits to store `k` indices in `[n]`.""" + return self.inst.k * self.inst.index_bitsize + + @cached_property + def ancilla_bitsize(self) -> SymbolicInt: + """ancillas used by the underlying QRO(A)M""" + return 0 + + @cached_property + def m_dtype(self): + r"""number of bits to store $j \in [\bar{m}]$.""" + m = self.inst.num_unique_constraints + bitsize = ceil(log2(m)) + return BQUInt(bitsize, m) + + @cached_property + def _qrom_bloq(self) -> QROM: + # TODO use QROAMClean? + + if self.inst.is_symbolic(): + return QROM.build_from_bitsize(self.inst.num_unique_constraints, self.scope_bitsize) + + assert isinstance(self.inst.batched_scopes, tuple) + scopes = np.array([S for S, _ in self.inst.batched_scopes], dtype=int) + assert scopes.shape == (self.inst.num_unique_constraints, self.inst.k) + return QROM.build_from_data( + *scopes.T, target_bitsizes=(self.inst.index_bitsize,) * self.inst.k + ) + + def build_composite_bloq(self, bb: 'BloqBuilder', j: 'Soquet') -> dict[str, 'SoquetT']: + if self.inst.is_symbolic(): + raise DecomposeTypeError(f"cannot decompose symbolic {self}") + + targets = { + f'target{i}_': bb.allocate(self.inst.index_bitsize) for i in range(int(self.inst.k)) + } + targets = bb.add_d(self._qrom_bloq, selection=j, **targets) + j = targets.pop('selection') + + U = bb.add( + Partition(self.scope_bitsize, self._qrom_bloq.target_registers).adjoint(), **targets + ) + return {'j': j, 'U': U} + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: + return {self._qrom_bloq: 1} + + +@bloq_example +def _load_scopes() -> LoadConstraintScopes: + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import Constraint, KXorInstance + + inst = KXorInstance( + n=6, + k=4, + constraints=( + Constraint(S=(0, 1, 2, 3), b=1), + Constraint(S=(0, 1, 4, 5), b=-1), + Constraint(S=(1, 2, 4, 5), b=1), + Constraint(S=(0, 3, 4, 5), b=1), + Constraint(S=(2, 3, 4, 5), b=1), + Constraint(S=(0, 1, 2, 3), b=1), + Constraint(S=(0, 3, 4, 5), b=1), + Constraint(S=(2, 3, 4, 5), b=1), + ), + ) + load_scopes = LoadConstraintScopes(inst) + return load_scopes + + +@bloq_example +def _load_scopes_symb() -> LoadConstraintScopes: + import sympy + + from qualtran.bloqs.optimization.k_xor_sat.kxor_instance import KXorInstance + + n, m, k = sympy.symbols("n m k", positive=True, integer=True) + inst = KXorInstance.symbolic(n=n, m=m, k=k) + load_scopes_symb = LoadConstraintScopes(inst) + return load_scopes_symb + + +_LOAD_INSTANCE_DOC = BloqDocSpec( + bloq_cls=LoadConstraintScopes, examples=[_load_scopes_symb, _load_scopes] +) + + +@frozen +class LoadUniqueScopeIndex(Bloq): + r"""Given a scope $S$, load $j$ such that $S = U_j$, the $j$-th unique scope. + + If the input contains an invalid scope, then any arbitrary value can be output. + + Registers: + S: A scope $S \in {[n] \choose k}$. + j (RIGHT): a number in $[\bar{m}]$ s.t. $S = U_j$. + ancilla (RIGHT): entangled intermediate qubits, to be uncomputed by the adjoint. + """ + + inst: KXorInstance + + @cached_property + def signature(self) -> 'Signature': + return Signature.build_from_dtypes(j=self.m_dtype, U=QAny(self.scope_bitsize)) + + @cached_property + def scope_bitsize(self) -> SymbolicInt: + """total number of bits to store `k` indices in `[n]`.""" + return self.inst.k * self.inst.index_bitsize + + @cached_property + def m_dtype(self): + r"""number of bits to store $j \in [\bar{m}]$.""" + m = self.inst.num_unique_constraints + bitsize = ceil(log2(m)) + return BQUInt(bitsize, m) + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: + counts = Counter[Bloq]() + + c = ssa.new_symbol("c") + counts[EqualsAConstant(self.scope_bitsize, c)] += self.inst.num_unique_constraints + + return counts + + +@frozen +class PRGAUniqueConstraintRHS(Bloq): + r"""Map $|j\rangle |0\rangle$ to $|j\rangle (\sqrt{E_j} |0\rangle + \sqrt{1 - |E_j|}|1\rangle)$ + + Given an instance $\mathcal{I}$, with unique scopes $U_j$ and corresponding RHS values + $E_j = B_\mathcal{I}(U_j)/M$ (where $M$ is the max. abs. entry, usually 2) + apply the above rotation on the target qubit. + + This is done by first rotating for $|E_j|$ (i.e. ignoring the sign), + by loading the values $\arccos{\sqrt{|E_j|}} / (2 * \pi)$, + and applying an `Rx` using an `RzViaPhaseGradient` surrounded by `H`. + + We then apply the sign correction of $i$ for the negative entries by an $S$ gate. + We ensure that the input data is sorted, therefore we can simply compare $j$ + with the largest negative index, and apply a `CS` gate. + + Args: + inst: kXOR instance $\mathcal{I}$. + angle_bitsize: number of bits to load the amplitude rotation angles to. + + Registers: + j: Selection index, loads the value of $E_j = B_\mathcal{I}(U_j)/M$ + q: rotation target. + """ + + inst: KXorInstance + angle_bitsize: SymbolicInt + is_controlled: bool = False + + @cached_property + def signature(self) -> 'Signature': + return Signature.build_from_dtypes(ctrl=QAny(self.n_ctrl), j=self.m_dtype, q=QBit()) + + @property + def n_ctrl(self) -> int: + return 1 if self.is_controlled else 0 + + @cached_property + def m_dtype(self): + r"""number of bits to store $j \in [\bar{m}]$.""" + m = self.inst.num_unique_constraints + bitsize = ceil(log2(m)) + return BQUInt(bitsize, m) + + @cached_property + def _angle_dtype(self): + return QFxp(self.angle_bitsize, self.angle_bitsize) + + @cached_property + def _qrom_angle_data( + self, + ) -> tuple[Union[HasLength, Sequence[int]], Union[HasLength, Sequence[int]]]: + M = self.inst.max_rhs + scopes = self.inst.batched_scopes + if is_symbolic(M) or is_symbolic(scopes): + m = self.inst.num_unique_constraints + return HasLength(m), HasLength(m) + + b = [b for _, b in scopes] + assert np.all(b == np.sort(b)), "data must be sorted!" + + amplitude_angles = np.arccos(np.sqrt(np.abs(b) / M)) + amplitude_angles_int = np.round(amplitude_angles * 2**self.angle_bitsize) + + signs = tuple(np.sign(b)) + return amplitude_angles_int, signs + + @cached_property + def _amplitude_qrom(self) -> QROM: + data, _ = self._qrom_angle_data + if is_symbolic(data): + return QROM.build_from_bitsize( + data_len_or_shape=self.inst.num_unique_constraints, + target_bitsizes=self.angle_bitsize, + num_controls=self.n_ctrl, + ) + + return QROM.build_from_data( + data, target_bitsizes=(self.angle_bitsize,), num_controls=self.n_ctrl + ) + + @cached_property + def _num_negative(self) -> SymbolicInt: + """returns $k$ s.t. the first $k$ elements are negative.""" + _, signs = self._qrom_angle_data + if is_symbolic(signs): + return self.inst.num_unique_constraints // 2 + + assert np.all(signs == np.sort(signs)), "data must be sorted!" + return int(np.searchsorted(signs, 0)) + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: + counts = Counter[Bloq]() + + # load the amplitudes + counts[self._amplitude_qrom] += 1 + + # apply a Rx rotation using Rx = H Rz H + counts[Hadamard()] += 2 + counts[RzViaPhaseGradient(self._angle_dtype, self._angle_dtype)] += 1 + + # apply the sign correction + # TODO use the half-bloq once implemented to wire this correctly + sign_compare = LessThanConstant(self.m_dtype.num_qubits, self._num_negative) + counts[sign_compare] += 1 + counts[SGate().controlled()] += 1 + + # unload amplitudes + counts[self._amplitude_qrom.adjoint()] += 1 + + return counts + + def get_ctrl_system(self, ctrl_spec: 'CtrlSpec') -> tuple['Bloq', 'AddControlledT']: + from qualtran.bloqs.mcmt.specialized_ctrl import get_ctrl_system_1bit_cv_from_bloqs + + return get_ctrl_system_1bit_cv_from_bloqs( + self, + ctrl_spec, + current_ctrl_bit=1 if self.is_controlled else None, + bloq_with_ctrl=self if self.is_controlled else attrs.evolve(self, is_controlled=True), + ctrl_reg_name='ctrl', + ) diff --git a/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance_test.py b/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance_test.py new file mode 100644 index 000000000..97f833b45 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/load_kxor_instance_test.py @@ -0,0 +1,49 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from unittest.mock import ANY + +import pytest + +from qualtran import Bloq +from qualtran.resource_counting import GateCounts, get_cost_value, QECGatesCost + +from .load_kxor_instance import _load_scopes, _load_scopes_symb + + +@pytest.mark.parametrize("bloq", [_load_scopes, _load_scopes_symb]) +def test_examples(bloq_autotester, bloq: Bloq): + if bloq_autotester.check_name == 'serialize': + pytest.skip() + + bloq_autotester(bloq) + + +def test_load_instance(): + bloq = _load_scopes() + + gc = get_cost_value(bloq, QECGatesCost()) + assert gc == GateCounts(and_bloq=3, clifford=ANY, measurement=ANY) + + # classical action + for j, (S, _) in enumerate(tuple(bloq.inst.batched_scopes)): # type: ignore + assert bloq.call_classically(j=j) == (j, bloq.inst.scope_as_int(S)) + + +def test_load_instance_cost_symb(): + bloq = _load_scopes_symb() + + m, k = bloq.inst.m, bloq.inst.k + logn = bloq.inst.index_bitsize + gc = get_cost_value(bloq, QECGatesCost()) + assert gc == GateCounts(and_bloq=m - 2, clifford=k * m * logn + m - 2, measurement=m - 2) diff --git a/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor.ipynb b/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor.ipynb new file mode 100644 index 000000000..b946aade8 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor.ipynb @@ -0,0 +1,235 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ee412c69", + "metadata": { + "cq.autogen": "title_cell" + }, + "source": [ + "# Algorithm: Planted Noise kXOR" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "df5a7866", + "metadata": { + "cq.autogen": "top_imports" + }, + "outputs": [], + "source": [ + "from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", + "from qualtran import QBit, QInt, QUInt, QAny\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", + "from typing import *\n", + "import numpy as np\n", + "import sympy\n", + "import cirq" + ] + }, + { + "cell_type": "markdown", + "id": "36559e8d", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.bloq_doc.md" + }, + "source": [ + "## `PlantedNoisyKXOR`\n", + "Algorithm for Planted Noisy kXOR.\n", + "\n", + "Problem (Problem 2.6 of Ref [1]):\n", + "\n", + "Given a noisy-kXOR instance $\\hat{\\mathcal{I}}$ which is drawn either:\n", + "\n", + "1. with planted advantage $\\rho$, from $\\tilde\\mathcal{P}^{z}_{n, k}(m, \\rho)$.\n", + "2. at random, from $\\tilde\\mathcal{R}_{n, k}(m)$.\n", + "\n", + "output a single bit such that it is whp `1` in case 1, and `0` in case 2.\n", + "\n", + "Algorithm (Section 4.4, Theorem 4.18):\n", + "We first split the instance into $\\hat{\\mathcal{I}} = \\mathcal{I} \\cup \\mathcal{I}_\\text{guide}$,\n", + "by placing each constraint independently in $\\mathcal{I}$ with prob. $1 - \\zeta$,\n", + "otherwise in $\\mathcal{I}_\\text{guide}$.\n", + "$\\zeta$ is picked to be $1 / \\ln n$.\n", + "\n", + "#### Parameters\n", + " - `inst_guide`: The subset of contraints $\\mathcal{I}_\\text{guide}$ for the guided state.\n", + " - `inst_solve`: The subset of constraints $\\mathcal{I}$ for eigenvalue estimation.\n", + " - `ell`: Kikuchi parameter $\\ell$.\n", + " - `rho`: the planted advantage $\\rho$ in the planted case. \n", + "\n", + "#### References\n", + " - [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1). \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f930da5f", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.bloq_doc.py" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat import PlantedNoisyKXOR" + ] + }, + { + "cell_type": "markdown", + "id": "18f43abd", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.example_instances.md" + }, + "source": [ + "### Example Instances" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1a28aa9c", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.solve_planted_symbolic" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat import KXorInstance\n", + "from qualtran.symbolics import HasLength\n", + "\n", + "n, m = sympy.symbols(\"n m\", positive=True, integer=True)\n", + "k = sympy.symbols(\"k\", positive=True, integer=True, even=True)\n", + "c = sympy.symbols(\"c\", positive=True, integer=True)\n", + "ell = c * k\n", + "rho = sympy.Symbol(r\"\\rho\", positive=True, real=True)\n", + "\n", + "inst = KXorInstance.symbolic(n, m, k)\n", + "zeta = 1 / ln(n)\n", + "solve_planted_symbolic = PlantedNoisyKXOR(\n", + " inst_guide=inst.subset(HasLength((1 - zeta) * m)),\n", + " inst_solve=inst.subset(HasLength(zeta * m)),\n", + " ell=ell,\n", + " rho=rho,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2df9b4ea", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.solve_planted" + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.optimization.k_xor_sat import KXorInstance\n", + "\n", + "rng = np.random.default_rng(42)\n", + "n, m, k = 50, 1000, 4\n", + "ell = k\n", + "rho = 0.8\n", + "\n", + "inst = KXorInstance.random_instance(n, m, k, planted_advantage=rho, rng=rng)\n", + "solve_planted = PlantedNoisyKXOR.from_inst(inst, ell=ell, rho=rho, zeta=0.1, rng=rng)" + ] + }, + { + "cell_type": "markdown", + "id": "505c1e9c", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.graphical_signature.md" + }, + "source": [ + "#### Graphical Signature" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2ead66fe", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.graphical_signature.py" + }, + "outputs": [], + "source": [ + "from qualtran.drawing import show_bloqs\n", + "show_bloqs([solve_planted_symbolic, solve_planted],\n", + " ['`solve_planted_symbolic`', '`solve_planted`'])" + ] + }, + { + "cell_type": "markdown", + "id": "bd068fb3", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.call_graph.md" + }, + "source": [ + "### Call Graph" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "946fca15", + "metadata": { + "cq.autogen": "PlantedNoisyKXOR.call_graph.py" + }, + "outputs": [], + "source": [ + "from qualtran.resource_counting.generalizers import ignore_split_join\n", + "solve_planted_symbolic_g, solve_planted_symbolic_sigma = solve_planted_symbolic.call_graph(max_depth=1, generalizer=ignore_split_join)\n", + "show_call_graph(solve_planted_symbolic_g)\n", + "show_counts_sigma(solve_planted_symbolic_sigma)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "2c8e9045-060a-4386-99be-5af7ee653fd6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "#### Counts totals:\n", + " - `Adjoint(subbloq=GuidedHamiltonianPhaseEstimation)`: $\\displaystyle \\left\\lceil{\\frac{202.020202020202 c^{0.5} k^{0.5} \\left(c k\\right)^{\\frac{c k}{2}}}{Part_{k}(\\ell)^{0.5} \\rho^{0.5} \\left(\\frac{\\left(\\frac{m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}}{{\\binom{n}{k}}}\\right)^{c} \\left(\\frac{\\rho^{2} m}{\\left(m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) \\operatorname{log}_{2}{\\left(n \\right)}}\\right)^{c}}{\\log{\\left(n \\right)}^{2}}\\right)^{0.5}}}\\right\\rceil$\n", + " - `GuidedHamiltonianPhaseEstimation`: $\\displaystyle \\left\\lceil{\\frac{202.020202020202 c^{0.5} k^{0.5} \\left(c k\\right)^{\\frac{c k}{2}}}{Part_{k}(\\ell)^{0.5} \\rho^{0.5} \\left(\\frac{\\left(\\frac{m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}}{{\\binom{n}{k}}}\\right)^{c} \\left(\\frac{\\rho^{2} m}{\\left(m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) \\operatorname{log}_{2}{\\left(n \\right)}}\\right)^{c}}{\\log{\\left(n \\right)}^{2}}\\right)^{0.5}}}\\right\\rceil + 1$\n", + " - `MultiControlZ`: $\\displaystyle \\left\\lceil{\\frac{202.020202020202 c^{0.5} k^{0.5} \\left(c k\\right)^{\\frac{c k}{2}}}{Part_{k}(\\ell)^{0.5} \\rho^{0.5} \\left(\\frac{\\left(\\frac{m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}}{{\\binom{n}{k}}}\\right)^{c} \\left(\\frac{\\rho^{2} m}{\\left(m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) \\operatorname{log}_{2}{\\left(n \\right)}}\\right)^{c}}{\\log{\\left(n \\right)}^{2}}\\right)^{0.5}}}\\right\\rceil$\n", + " - `ZGate`: $\\displaystyle \\left\\lceil{\\frac{202.020202020202 c^{0.5} k^{0.5} \\left(c k\\right)^{\\frac{c k}{2}}}{Part_{k}(\\ell)^{0.5} \\rho^{0.5} \\left(\\frac{\\left(\\frac{m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}}{{\\binom{n}{k}}}\\right)^{c} \\left(\\frac{\\rho^{2} m}{\\left(m \\left(1 - \\frac{1}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) + \\frac{m}{\\operatorname{log}_{2}{\\left(n \\right)}}\\right) \\operatorname{log}_{2}{\\left(n \\right)}}\\right)^{c}}{\\log{\\left(n \\right)}^{2}}\\right)^{0.5}}}\\right\\rceil$" + ], + "text/plain": [ + "<IPython.core.display.Markdown object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "_, sigma = solve_planted_symbolic.call_graph(max_depth=2, generalizer=ignore_split_join)\n", + "show_counts_sigma(sigma) # inverse of Eq. 150" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor.py b/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor.py new file mode 100644 index 000000000..865e34946 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor.py @@ -0,0 +1,424 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from functools import cached_property +from typing import Optional + +import numpy as np +import scipy +import sympy +from attrs import field, frozen + +from qualtran import Bloq, bloq_example, BloqBuilder, BloqDocSpec, Signature, SoquetT +from qualtran.bloqs.state_preparation.black_box_prepare import BlackBoxPrepare +from qualtran.bloqs.state_preparation.prepare_base import PrepareOracle +from qualtran.resource_counting import BloqCountDictT, SympySymbolAllocator +from qualtran.symbolics import ( + ceil, + HasLength, + is_symbolic, + ln, + log2, + prod, + slen, + ssqrt, + SymbolicFloat, + SymbolicInt, +) + +from .guided_hamiltonian import GuidedHamiltonian +from .kikuchi_block_encoding import KikuchiHamiltonian +from .kikuchi_guiding_state import GuidingState, SimpleGuidingState +from .kxor_instance import KXorInstance + + +def comb(n: SymbolicInt, k: SymbolicInt) -> SymbolicInt: + """compute n choose k""" + if is_symbolic(n, k): + return sympy.binomial(n, k) + return scipy.special.comb(n, k) + + +@frozen(kw_only=True) +class KikuchiAverageDegreeTheorem: + """Compute the average degree of the Kikuchi matrix. + + The Alice theorem (Thm 2.21) guarantees this with high probability + for random/planted instances. + """ + + n: SymbolicInt + k: SymbolicInt + ell: SymbolicInt + + @cached_property + def delta(self) -> SymbolicFloat: + """Eq 19""" + n, k, l = self.n, self.k, self.ell + term_1 = comb(k, k // 2) + term_2 = comb(n - k, l - k // 2) / comb(n, l) + return term_1 * term_2 + + +@frozen(kw_only=True) +class AliceTheorem: + r"""Alice theorem, E.g. Theorem 2.21. + + Consider a $k$XOR instance over $n$ variables and $m$ clauses, with Kikuchi parameter $\ell$. + + Assume: + - $\ell \ge k/2$ + - $n \gg k \ell$ + + For any parameters $\kappa \le 1$ and $0 < \epsilon \le \kappa/(2+\kappa)$, + assume: $m$ satisfies + $m/n \ge C_\kappa (n/\ell)^{(k-2)/2}$ + where + $C_\kappa = 2(1+\epsilon)(1+\kappa) \kappa^{-2} {k \choose k/2}^{-1} \ln n$ + + Then for a randomly drawn instance $\mathcal{I}$ (i.e. advantage 0), + except with probability $3 n^{-\epsilon \ell}$, we are guaranteed: + + $\lambda_\max{\mathcal{K}_\ell(\mathcal{I})} \le \kappa d$ + where + $d = \delta_{\ell,n,k} m$. + + Args: + n: number of variables $n$ + k: number of variables per equation $k$ + ell: Kikuchi parameter + kappa: parameter $\kappa$ + eps: parameter $\epsilon$ + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + """ + + n: int + k: int + ell: int + kappa: float + eps: float = field() + + @eps.default + def _default_max_eps(self): + return self.kappa / (2 + self.kappa) + + def __attrs_post_init__(self): + assert self.k % 2 == 0, "k must be even" + assert self.ell % self.k == 0, "l must be a multiple of k" + # assert self.n >= self.k * self.ell, "n must be atleast lk" + assert 0 <= self.kappa <= 1 + assert 0 < self.eps <= self.kappa / (2 + self.kappa) + + @cached_property + def C_kappa(self): + """Eq 20 (right)""" + term_1 = 2 * (1 + self.eps) * (1 + self.kappa) / self.kappa**2 + term_2 = comb(self.k, self.k // 2) + term_3 = np.log(self.n) + + value = (term_1 / term_2) * term_3 + return value + + @cached_property + def fail_prob(self): + return 3 / self.n ** (self.eps * self.ell) + + @cached_property + def min_m(self): + """Eq 20 (left)""" + m = self.C_kappa * (self.n / self.ell) ** (self.k // 2) * self.ell + return ceil(m) + + +@frozen(kw_only=True) +class GuidingStateOverlapTheorem: + r"""Lower-bound the overlap of the prepared guiding state with the eigenspace. + + This is an implementation of Theorem 2.40. + + Args: + n: number of variables + k: number of variables per constraint + m_hat: total number of constraints + ell: kikuchi parameter $\ell$ + zeta: the probability of picking a constraint for $\mathcal{I}_\text{guide}$. + nu: parameter in $(0, .99]$. + eps: parameter. + rho: planted advantage. + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Section 2.7, Theorem 2.40. + """ + + n: SymbolicInt + k: SymbolicInt + m_hat: SymbolicInt + ell: SymbolicInt + zeta: SymbolicFloat + nu: SymbolicFloat + eps: SymbolicFloat + rho: SymbolicFloat + + @cached_property + def part_k_l(self) -> SymbolicInt: + ell, k = self.ell, self.k + if is_symbolic(ell) or is_symbolic(k): + return sympy.Symbol(r"Part_{k}(\ell)", positive=True, integer=True) + return prod([comb(ell - i * k, k) for i in range(ell // k)]) + + @cached_property + def xi(self): + r"""Eq 60 $\xi$""" + term_1 = self.part_k_l + term_2 = (self.rho * self.eps * self.nu) / (200 * self.ell * ln(self.n)) + term_3 = (self.rho**2 * self.zeta) ** (self.ell // self.k) + return term_1 * term_2 * term_3 + + @cached_property + def overlap_probability(self) -> SymbolicFloat: + term_2_base = self.m_hat / comb(self.n, self.k) + term_2 = term_2_base ** (self.ell / self.k) + return self.xi * term_2 + + +@frozen +class PlantedNoisyKXOR(Bloq): + r"""Algorithm for Planted Noisy kXOR. + + Problem (Problem 2.6 of Ref [1]): + + Given a noisy-kXOR instance $\hat{\mathcal{I}}$ which is drawn either: + + 1. with planted advantage $\rho$, from $\tilde\mathcal{P}^{z}_{n, k}(m, \rho)$. + 2. at random, from $\tilde\mathcal{R}_{n, k}(m)$. + + output a single bit such that it is whp `1` in case 1, and `0` in case 2. + + Algorithm (Section 4.4, Theorem 4.18): + We first split the instance into $\hat{\mathcal{I}} = \mathcal{I} \cup \mathcal{I}_\text{guide}$, + by placing each constraint independently in $\mathcal{I}$ with prob. $1 - \zeta$, + otherwise in $\mathcal{I}_\text{guide}$. + $\zeta$ is picked to be $1 / \ln n$. + + Args: + inst_guide: The subset of contraints $\mathcal{I}_\text{guide}$ for the guided state. + inst_solve: The subset of constraints $\mathcal{I}$ for eigenvalue estimation. + ell: Kikuchi parameter $\ell$. + rho: the planted advantage $\rho$ in the planted case. + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + """ + + inst_guide: KXorInstance + inst_solve: KXorInstance + ell: SymbolicInt + rho: SymbolicFloat + _guiding_state_overlap: Optional[SymbolicFloat] = field(kw_only=True, default=None) + + def __attrs_post_init__(self): + k = self.inst_guide.k + if not is_symbolic(k): + assert k % 2 == 0, f"{k=} must be even" + + ell = self.ell + if not is_symbolic(k, ell): + assert ell % k == 0 and ell >= k, f"{ell=} must be a multiple of {k=}" + + @cached_property + def signature(self) -> 'Signature': + return self.guided_hamiltonian_bloq.signature + + @classmethod + def from_inst( + cls, + inst: KXorInstance, + ell: SymbolicInt, + rho: SymbolicFloat, + *, + rng: np.random.Generator, + zeta: Optional[SymbolicFloat] = None, + guiding_state_overlap: Optional[SymbolicFloat] = None, + ): + if zeta is None: + zeta = 1 / log2(inst.n) + + (use_for_guide,) = np.nonzero(np.atleast_1d(rng.random(inst.m) < zeta)) + inst_guide = inst.subset(tuple(use_for_guide)) + + if is_symbolic(inst, use_for_guide): + inst_solve = inst.subset(HasLength(inst.m - slen(use_for_guide))) + else: + mask = np.ones(inst.m) + mask[np.array(use_for_guide)] = 0 + (rest,) = np.nonzero(mask) + inst_solve = inst.subset(tuple(rest)) + + return cls( + inst_guide=inst_guide, + inst_solve=inst_solve, + ell=ell, + rho=rho, + guiding_state_overlap=guiding_state_overlap, + ) + + @cached_property + def guiding_state_and_coefficient(self) -> tuple[PrepareOracle, SymbolicFloat]: + r"""Return a bloq that prepares the guiding state, and its coefficient. + + If the bloq prepares $\beta |\Psi\rangle|0\rangle + |\perp\rangle|1\rangle$, + then this will return $|\beta|$. + + The returned $\beta$ is an theoretical lower bound on the true value, + and is correct for $1 - o(1)$ fraction of random instances. + """ + if self.ell == self.inst_guide.k: + return SimpleGuidingState(inst=self.inst_guide), 1 + bloq = GuidingState(inst=self.inst_guide, ell=self.ell) + return bloq, bloq.amplitude_good_part + + @cached_property + def guiding_state_overlap_guarantee(self) -> GuidingStateOverlapTheorem: + """Invoke Theorem 2.40 to obtain a lower bound on the guiding state overlap. + + The below parameters are picked from Theorem 4.18, proof para 2. + """ + n, k = self.inst_guide.n, self.inst_guide.k + m_guide = self.inst_guide.m + m_solve = self.inst_solve.m + m_hat = m_guide + m_solve + zeta = m_solve / m_hat + return GuidingStateOverlapTheorem( + n=n, k=k, ell=self.ell, m_hat=m_hat, zeta=zeta, nu=1 / ln(n), eps=0.005, rho=self.rho + ) + + @cached_property + def guiding_state_overlap(self) -> SymbolicFloat: + if self._guiding_state_overlap is not None: + return self.guiding_state_overlap + _, guiding_state_good_coeff = self.guiding_state_and_coefficient + return guiding_state_good_coeff + + @cached_property + def overlap(self) -> SymbolicFloat: + # guiding state + guiding_state_good_coeff = self.guiding_state_overlap + + # overlap of |\Gamma(A)> with the threshold eigenspace + overlap_good_eigen = self.guiding_state_overlap_guarantee.overlap_probability**0.5 + + # total overlap is the sqrt probability of the ancilla being 0, + # and the state being in the >= lambda eigenspace. + overlap = guiding_state_good_coeff * overlap_good_eigen + + return overlap + + @cached_property + def degree_guarantee(self) -> KikuchiAverageDegreeTheorem: + return KikuchiAverageDegreeTheorem(n=self.inst_solve.n, k=self.inst_solve.k, ell=self.ell) + + @cached_property + def sparsity(self) -> SymbolicInt: + """sparsity of the kikuchi matrix, $d$""" + # d = \delta m + d = self.degree_guarantee.delta * self.inst_solve.m + if is_symbolic(d): + return d # type: ignore + return ceil(d) + + @cached_property + def hamiltonian(self) -> KikuchiHamiltonian: + return KikuchiHamiltonian( + inst=self.inst_solve, ell=self.ell, entry_bitsize=10, s=self.sparsity + ) + + @cached_property + def guided_hamiltonian_bloq(self) -> GuidedHamiltonian: + # Thm 4.18 proof para 2. + # lambda = 0.995 rho d + eigenvalue_threshold = 0.995 * self.rho * self.sparsity + + kappa = 0.99 * self.rho + eps = 0.005 + + # Thm 4.18 proof para 3 + # kappa' <= (1 - alpha) lambda + # ==> alpha <= 1 - kappa'/lambda + # we pick kappa' s.t. it satisfies the alice theorem for inst_solve.m + # simple approximation: kappa' = kappa / sqrt(1-zeta) + zeta = self.inst_guide.m / (self.inst_guide.m + self.inst_solve.m) + kappa_prime = kappa / ssqrt(1 - zeta) + alpha = 1 - kappa_prime / eigenvalue_threshold + if not is_symbolic(alpha): + assert alpha > 0, f"got negative {alpha=}" + + guiding_state, _ = self.guiding_state_and_coefficient + + return GuidedHamiltonian( + self.hamiltonian, + BlackBoxPrepare(guiding_state), + lambd=eigenvalue_threshold, + alpha=alpha, + gamma=self.overlap, + ) + + def build_composite_bloq(self, bb: 'BloqBuilder', **soqs: 'SoquetT') -> dict[str, 'SoquetT']: + soqs = bb.add_d(self.guided_hamiltonian_bloq, **soqs) + return soqs + + def build_call_graph(self, ssa: 'SympySymbolAllocator') -> BloqCountDictT: + return {self.guided_hamiltonian_bloq: 1} + + +@bloq_example +def _solve_planted() -> PlantedNoisyKXOR: + from qualtran.bloqs.optimization.k_xor_sat import KXorInstance + + rng = np.random.default_rng(42) + n, m, k = 50, 1000, 4 + ell = k + rho = 0.8 + + inst = KXorInstance.random_instance(n, m, k, planted_advantage=rho, rng=rng) + solve_planted = PlantedNoisyKXOR.from_inst(inst, ell=ell, rho=rho, zeta=0.1, rng=rng) + return solve_planted + + +@bloq_example +def _solve_planted_symbolic() -> PlantedNoisyKXOR: + from qualtran.bloqs.optimization.k_xor_sat import KXorInstance + from qualtran.symbolics import HasLength + + n, m = sympy.symbols("n m", positive=True, integer=True) + k = sympy.symbols("k", positive=True, integer=True, even=True) + c = sympy.symbols("c", positive=True, integer=True) + ell = c * k + rho = sympy.Symbol(r"\rho", positive=True, real=True) + + inst = KXorInstance.symbolic(n, m, k) + zeta = 1 / ln(n) + solve_planted_symbolic = PlantedNoisyKXOR( + inst_guide=inst.subset(HasLength((1 - zeta) * m)), + inst_solve=inst.subset(HasLength(zeta * m)), + ell=ell, + rho=rho, + ) + return solve_planted_symbolic + + +_PLANTED_NOISY_KXOR_DOC = BloqDocSpec( + bloq_cls=PlantedNoisyKXOR, examples=[_solve_planted_symbolic, _solve_planted] +) diff --git a/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor_test.py b/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor_test.py new file mode 100644 index 000000000..37a415332 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/planted_noisy_kxor_test.py @@ -0,0 +1,116 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import numpy as np +import pytest +import sympy + +from qualtran.drawing import show_call_graph +from qualtran.resource_counting import get_cost_value, QECGatesCost +from qualtran.resource_counting.generalizers import ignore_alloc_free, ignore_split_join +from qualtran.symbolics import ln, log2 + +from .kxor_instance import KXorInstance +from .planted_noisy_kxor import ( + _solve_planted, + _solve_planted_symbolic, + AliceTheorem, + PlantedNoisyKXOR, +) + + +@pytest.fixture +def rng(): + return np.random.default_rng(42) + + +@pytest.mark.xfail +def test_alice_thm_symb(): + n, m = sympy.symbols("n m", positive=True, integer=True) + k = sympy.symbols("k", positive=True, integer=True, even=True) + rho = sympy.symbols(r"\rho", positive=True, real=True) + c = sympy.symbols(r"c", positive=True, integer=True) + thm = AliceTheorem(n=n, k=k, ell=c * k, kappa=0.99 * rho, eps=0.005) + _ = thm.C_kappa() + _ = thm.min_m() + _ = thm.fail_prob() + + +@pytest.mark.parametrize("bloq_ex", [_solve_planted, _solve_planted_symbolic]) +def test_examples(bloq_autotester, bloq_ex): + if bloq_autotester.check_name == 'serialize': + pytest.skip() + + bloq_autotester(bloq_ex) + + +def test_call_graph(): + _solve_planted().call_graph() + + +def test_call_graph_symb(): + algo = _solve_planted_symbolic() + g, sigma = algo.call_graph(generalizer=[ignore_split_join, ignore_alloc_free]) + show_call_graph(g) + + +def example_random_instance(*, k=4, n=100, m=1000, c=2, rho=0.8, seed=120) -> PlantedNoisyKXOR: + # generate instance + rng = np.random.default_rng(seed) + ell = c * k + inst = KXorInstance.random_instance(n=n, m=m, k=k, planted_advantage=rho, rng=rng) + algo_bloq = PlantedNoisyKXOR.from_inst(inst=inst, ell=ell, rho=rho, zeta=1 / ln(n), rng=rng) + + return algo_bloq + + +def test_gate_cost(): + bloq = example_random_instance() + gc = get_cost_value(bloq, QECGatesCost()) + t_cost = gc.total_t_count(ts_per_cswap=4) + + n = bloq.inst_guide.n + m = bloq.inst_guide.m + bloq.inst_solve.m + ell = bloq.ell + c = ell // bloq.inst_guide.k + + big_O_expected = n ** (ell / 4) * (m**0.5) * ell**ell * log2(n) ** (c // 2) + print() + print(t_cost) + print(t_cost / big_O_expected) + print(big_O_expected) + print(t_cost / big_O_expected * bloq.guiding_state_overlap) + print(1 / bloq.guiding_state_overlap) + print(1 / bloq.guiding_state_overlap_guarantee.overlap_probability**0.5) + + +@pytest.mark.parametrize("n", [40, 50, 60, 70, 80, 90, 100]) +@pytest.mark.parametrize("k", [4, 8]) +@pytest.mark.parametrize("c", [2, 3, 4]) +def test_more_costs(n, k, c): + if c * k == 32 and n <= 40: + pytest.skip("too small n") + + bloq = example_random_instance(k=k, c=c, n=n, m=n, seed=142) + cost = get_cost_value(bloq, QECGatesCost()) + print(cost) + + +@pytest.mark.slow +@pytest.mark.parametrize("n", [10**4, 10**5]) +def test_large(n): + k = 4 + c = 32 // 4 + bloq = example_random_instance(k=k, c=c, n=n, m=n * 10, seed=142) + cost = get_cost_value(bloq, QECGatesCost()) + print(cost) diff --git a/qualtran/bloqs/optimization/k_xor_sat/shims.py b/qualtran/bloqs/optimization/k_xor_sat/shims.py new file mode 100644 index 000000000..720998180 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/shims.py @@ -0,0 +1,77 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from typing import Optional + +import attrs + +from qualtran import Bloq, CtrlSpec, Signature +from qualtran.resource_counting import CostKey, GateCounts, QECGatesCost +from qualtran.symbolics import SymbolicInt + + +@attrs.frozen +class ArbitraryGate(Bloq): + """Placeholder gate for costing + + Footnote 18, page 29: + By āgate complexityā, we mean the total number of (arbitrary) 1- and 2-qubit gates + used by the quantum algorithm. These gates can be further represented using a + finite universal gate set with a logarithmic overhead. + + References: + [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1) + Section 4.4.2 for algorithm. Section 2.4 for definitions and notation. + """ + + n_ctrls: SymbolicInt = 0 + + @property + def signature(self) -> 'Signature': + return Signature.build(q=1 + self.n_ctrls) + + def my_static_costs(self, cost_key: 'CostKey'): + if isinstance(cost_key, QECGatesCost): + # placeholder cost: reduce controls to single bit, and use C-SU2 (say). + return GateCounts(rotation=1, and_bloq=self.n_ctrls) + + return NotImplemented + + def adjoint(self) -> 'Bloq': + return self + + def get_ctrl_system(self, ctrl_spec: CtrlSpec): + ctrl_bloq = attrs.evolve(self, n_ctrls=self.n_ctrls + ctrl_spec.num_qubits) + + return ctrl_bloq, NotImplemented + + +def generalize_1_2_qubit_gates(b: Bloq) -> Optional[Bloq]: + from qualtran.bloqs.basic_gates import GlobalPhase, Identity + from qualtran.bloqs.bookkeeping import ArbitraryClifford + from qualtran.resource_counting.classify_bloqs import ( + bloq_is_clifford, + bloq_is_rotation, + bloq_is_t_like, + ) + + if bloq_is_t_like(b) or bloq_is_clifford(b) or bloq_is_rotation(b): + return ArbitraryGate() + + if isinstance(b, ArbitraryClifford): + return ArbitraryGate() + + if isinstance(b, (GlobalPhase, Identity)): + return None + + return b diff --git a/qualtran/bloqs/optimization/k_xor_sat/tutorial_planted_noisy_kxor.py.ipynb b/qualtran/bloqs/optimization/k_xor_sat/tutorial_planted_noisy_kxor.py.ipynb new file mode 100644 index 000000000..e72a1ed87 --- /dev/null +++ b/qualtran/bloqs/optimization/k_xor_sat/tutorial_planted_noisy_kxor.py.ipynb @@ -0,0 +1,2526 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f9ab6a67-1a3c-459f-9716-cda924fa4efe", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "markdown", + "id": "eceae6a5-5497-4ea9-8c24-0abd0f45554c", + "metadata": {}, + "source": [ + "### Implementing [Quartic quantum speedups for planted inference](https://arxiv.org/abs/2406.19378v1)" + ] + }, + { + "cell_type": "markdown", + "id": "d5eb2c1f-a57d-4b18-8b26-454da506578b", + "metadata": {}, + "source": [ + "### Problem Definition" + ] + }, + { + "cell_type": "markdown", + "id": "f6e0f089-9c57-4d87-8478-5b6660cb6395", + "metadata": {}, + "source": [ + "**Definition 2.2 (simplified):**\n", + "A kXOR instance $\\mathcal{I}$ on $n$ variables in ${0, 1}$ is a collection of $m$ constraints, each of the form\n", + "$$ x_{c_1} \\oplus x_{c_2} \\oplus ... x_{c_k} = b $$ " + ] + }, + { + "cell_type": "markdown", + "id": "ebd9642b-99a2-4ee4-b905-826174d5a8c7", + "metadata": {}, + "source": [ + "**Notation 2.3**\n", + "Random Instance: Pick each clause independently:\n", + "- Pick $C$, a $k$ subset of $[n] = \\{1, ... n\\}$ uniformly at random.\n", + "- Pick $b \\in {0, 1}$ uniformly at random." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1756cf95-b8ad-42ca-bb35-59528bf96538", + "metadata": {}, + "outputs": [], + "source": [ + "from qualtran.bloqs.max_k_xor_sat import KXorInstance, Constraint\n", + "\n", + "n, k = 10, 4\n", + "cs = (\n", + " Constraint((0, 1, 2, 3), -1), # read: x_0 ^ x_1 ^ x_2 ^ x_3 = 0\n", + " Constraint((0, 2, 4, 5), 1),\n", + " Constraint((0, 3, 4, 5), 1),\n", + " Constraint((0, 3, 4, 5), 1),\n", + " Constraint((1, 2, 3, 4), -1),\n", + " Constraint((1, 3, 4, 5), -1),\n", + " Constraint((1, 3, 4, 5), -1),\n", + " Constraint((2, 3, 4, 5), 1),\n", + ")\n", + "simple_inst = KXorInstance(n, k, cs)\n", + "simple_inst" + ] + }, + { + "cell_type": "markdown", + "id": "5fc71a1f-e1d4-44fb-b657-8d43af87626f", + "metadata": {}, + "source": [ + "**Notation 2.4 (simplified)** Planted Instance:\n", + "Given $\\rho \\in [0, 1]$ (the _planted advantage_),\n", + "\n", + "first pick a secret assignment $z \\in \\{0, 1\\}^n$.\n", + "Now pick each clause independently by: \n", + "- Pick $C$, a $k$ subset of $[n]$ uniformly at random.\n", + "- Pick noise $\\eta \\in {0, 1}$, s.t. $\\eta = 0$ with probability $(1 + \\rho)/2$\n", + "- Set $b = C(z) \\oplus \\eta$\n", + "\n", + "Note: when $\\rho = 0$, the noise is random, and when $\\rho = 1$, there is no noise." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d334a8e-3792-4ece-9f9c-d77da3111aa2", + "metadata": {}, + "outputs": [], + "source": [ + "random_inst = KXorInstance.random_instance(\n", + " n=10, \n", + " m=20, \n", + " k=4,\n", + " planted_advantage=0.8,\n", + " rng=np.random.default_rng(42),\n", + ")\n", + "random_inst" + ] + }, + { + "cell_type": "markdown", + "id": "cd35802e-1778-44de-81bd-9356da3999a7", + "metadata": {}, + "source": [ + "## Problem\n", + "\n", + "**Problem 2.6 (Planted Noisy kXOR)**\n", + "Given $\\rho \\in (0, 1)$, and an instance $\\mathcal{I}$ that is promised to be either drawn from the random distribution or planted distribution (with $\\rho$), distinguish which case it is." + ] + }, + { + "cell_type": "markdown", + "id": "4e401d1e-157c-4f49-adfe-9ceeb315ba6d", + "metadata": {}, + "source": [ + "## Kikuchi Method\n", + "This is a technique to reduce $k$XOR problems to $2$XOR problems, on an exponentially larger set of variables (say, $O(n^k)$).\n", + "The 2XOR is known to be efficiently solvable by some spectral analysis.\n", + "\n", + "For this, we pick our new variables as subsets of $[n]$ of size $k$, call them $X_S$ for each subset $S$.\n", + "There are ${n \\choose k}$ variables now, and for $k \\ll n$, this is about $O(n^k)$.\n", + "\n", + "The equations are of the form $X_S \\oplus X_T = b(S, T)$ for every $S, T$ with $|S \\Delta T| = k$.\n", + "Here $b(S, T)$ is the xor of all variables in S and T (common ones cancel out, leaving only the $k$ as above)" + ] + }, + { + "cell_type": "markdown", + "id": "da3f5e5c-67dd-4717-962b-23052fdd30ad", + "metadata": {}, + "source": [ + "## Quantum Algorithm\n", + "\n", + "**Theorem 4.18 (simplified)**\n", + "Let $k$ (even) and $\\rho \\in (0, 1)$ be known constants.\n", + "\n", + "We are given an instance $\\mathcal{I}$ which is either random or planted (with advantage $\\rho$),\n", + "where the number of constraints $m$ is picked above a given threshold (see Alice Theorem).\n", + "\n", + "For a parameter $\\ell$, if we have a classical _Kikuchi style_ algorithm with complexity $\\tilde{O}(n^\\ell)$,\n", + "then there is a quantum algorithm with $\\tilde{O}(n^{\\ell/4} m \\ell^{O{\\ell}} \\log^{\\ell/2k}n)$." + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "9b5a6bbb-e895-47d9-8ea6-5ab1f07329e3", + "metadata": { + "ExecuteTime": { + "end_time": "2024-08-27T13:03:40.693090Z", + "start_time": "2024-08-27T13:03:38.179464Z" + } + }, + "outputs": [], + "source": [ + "from qualtran.bloqs.max_k_xor_sat.planted_noisy_kxor import PlantedNoisyKXOR\n", + "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "b5e3a55c-00a9-40a4-b309-79fa008b0760", + "metadata": { + "ExecuteTime": { + "end_time": "2024-08-27T13:03:40.693090Z", + "start_time": "2024-08-27T13:03:38.179464Z" + } + }, + "outputs": [], + "source": [ + "def make_algo_example():\n", + " k = 4\n", + " n, m = 100, 1000\n", + " rho = 0.8\n", + " \n", + " c = 2 # Kikuchi param: ell = c * k\n", + " \n", + " # generate instance\n", + " rng = np.random.default_rng(142)\n", + " ell = c * k\n", + " inst = KXorInstance.random_instance(n=n, m=m, k=k, planted_advantage=rho, rng=rng)\n", + " algo_bloq = PlantedNoisyKXOR.from_inst(inst=inst, ell=ell, rho=rho, zeta=1 / np.log(n), rng=rng)\n", + "\n", + " expected_complexity = n ** (ell/4) * m * ell**ell * np.log(n)**(c//2)\n", + "\n", + " return algo_bloq, expected_complexity" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "46dc55f4-3873-40a2-9509-b723493eeb85", + "metadata": {}, + "outputs": [], + "source": [ + "bloq, cost_O_tilde = make_algo_example()" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "04de6797-5986-461e-b040-2ec7fab2bcc2", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"453pt\" height=\"206pt\" viewBox=\"0.00 0.00 453.00 206.00\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 202)\">\n", + "<title>my_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-202 449,-202 449,4 -4,4\"/>\n", + "<!-- phase_estimate_G1 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>phase_estimate_G1</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-175.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- PlantedNoisyKXOR -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>PlantedNoisyKXOR</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-145 164,-163 281,-163 281,-145 164,-145\"/>\n", + "<text text-anchor=\"start\" x=\"173.38\" y=\"-150.5\" font-family=\"Times,serif\" font-size=\"10.00\">PlantedNoisyKXOR</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-122 164,-145 281,-145 281,-122 164,-122\"/>\n", + "<text text-anchor=\"start\" x=\"167\" y=\"-128.7\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-99 164,-122 281,-122 281,-99 164,-99\"/>\n", + "<text text-anchor=\"start\" x=\"197\" y=\"-105.7\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-76 164,-99 281,-99 281,-76 164,-76\"/>\n", + "<text text-anchor=\"start\" x=\"179.38\" y=\"-82.7\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"164,-53 164,-76 281,-76 281,-53 164,-53\"/>\n", + "<text text-anchor=\"start\" x=\"176\" y=\"-59.7\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- phase_estimate_G1->PlantedNoisyKXOR -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>phase_estimate_G1:e->PlantedNoisyKXOR:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M127,-180C152.38,-180 138.76,-137.06 161.09,-133.71\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-133.61\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-161.25\" font-family=\"Times,serif\" font-size=\"10.00\">7</text>\n", + "</g>\n", + "<!-- system_G10 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>system_G10</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-121.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- system_G10->PlantedNoisyKXOR -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>system_G10:e->PlantedNoisyKXOR:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M97.97,-126C127.17,-126 133.47,-111.45 161.24,-110.54\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-110.52\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-115.25\" font-family=\"Times,serif\" font-size=\"10.00\">56</text>\n", + "</g>\n", + "<!-- walk_ancilla_G0 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>walk_ancilla_G0</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- walk_ancilla_G0->PlantedNoisyKXOR -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>walk_ancilla_G0:e->PlantedNoisyKXOR:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M115.58,-72C137.29,-72 141.12,-86.31 161.44,-87.43\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-87.46\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-85.25\" font-family=\"Times,serif\" font-size=\"10.00\">58</text>\n", + "</g>\n", + "<!-- guide_ancilla_G7 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>guide_ancilla_G7</title>\n", + "<text text-anchor=\"middle\" x=\"63.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- guide_ancilla_G7->PlantedNoisyKXOR -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>guide_ancilla_G7:e->PlantedNoisyKXOR:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M118.95,-18C146.71,-18 136.05,-61.29 161.11,-64.33\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"162.5\" cy=\"-64.41\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"145.5\" y=\"-55.25\" font-family=\"Times,serif\" font-size=\"10.00\">27</text>\n", + "</g>\n", + "<!-- phase_estimate_G9 -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>phase_estimate_G9</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-175.32\" font-family=\"Times,serif\" font-size=\"14.00\">phase_estimate</text>\n", + "</g>\n", + "<!-- PlantedNoisyKXOR->phase_estimate_G9 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>PlantedNoisyKXOR:e->phase_estimate_G9:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-133.5C306.38,-133.5 292.76,-176.44 315.09,-179.79\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"316.5\" cy=\"-179.89\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-161.25\" font-family=\"Times,serif\" font-size=\"10.00\">7</text>\n", + "</g>\n", + "<!-- system_G4 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>system_G4</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-121.33\" font-family=\"Times,serif\" font-size=\"14.00\">system</text>\n", + "</g>\n", + "<!-- PlantedNoisyKXOR->system_G4 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>PlantedNoisyKXOR:e->system_G4:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-110.5C310.2,-110.5 316.5,-125.05 344.28,-125.96\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"345.53\" cy=\"-125.98\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-115.25\" font-family=\"Times,serif\" font-size=\"10.00\">56</text>\n", + "</g>\n", + "<!-- walk_ancilla_G8 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>walk_ancilla_G8</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-67.33\" font-family=\"Times,serif\" font-size=\"14.00\">walk_ancilla</text>\n", + "</g>\n", + "<!-- PlantedNoisyKXOR->walk_ancilla_G8 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>PlantedNoisyKXOR:e->walk_ancilla_G8:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-87.5C302.71,-87.5 306.54,-73.19 326.86,-72.07\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"327.92\" cy=\"-72.04\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-85.25\" font-family=\"Times,serif\" font-size=\"10.00\">58</text>\n", + "</g>\n", + "<!-- guide_ancilla_G2 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>guide_ancilla_G2</title>\n", + "<text text-anchor=\"middle\" x=\"381.5\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">guide_ancilla</text>\n", + "</g>\n", + "<!-- PlantedNoisyKXOR->guide_ancilla_G2 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>PlantedNoisyKXOR:e->guide_ancilla_G2:w</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M281,-64.5C308.76,-64.5 298.1,-21.21 323.17,-18.17\"/>\n", + "<ellipse fill=\"black\" stroke=\"black\" cx=\"324.55\" cy=\"-18.09\" rx=\"1\" ry=\"1\"/>\n", + "<text text-anchor=\"middle\" x=\"299.5\" y=\"-55.25\" font-family=\"Times,serif\" font-size=\"10.00\">27</text>\n", + "</g>\n", + "</g>\n", + "</svg>" + ], + "text/plain": [ + "<IPython.core.display.SVG object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_bloq(bloq)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "6cdc8096-84da-4358-b068-1e4438be51e4", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"24386pt\" height=\"580pt\" viewBox=\"0.00 0.00 24386.00 579.50\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 575.5)\">\n", + "<title>counts</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-575.5 24382,-575.5 24382,4 -4,4\"/>\n", + "<!-- b0 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>b0</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9484,-571.5 9084,-571.5 9084,-535.5 9484,-535.5 9484,-571.5\"/>\n", + "<text text-anchor=\"start\" x=\"9215.38\" y=\"-553.2\" font-family=\"Times,serif\" font-size=\"14.00\">PlantedNoisyKXOR</text>\n", + "<text text-anchor=\"start\" x=\"9092\" y=\"-543\" font-family=\"monospace\" font-size=\"10.00\">inst_guide=KXorInst ..., inst_solve=KXorInst ..., ell=8, rho=0.8</text>\n", + "</g>\n", + "<!-- b1 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>b1</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9610,-482.25 8958,-482.25 8958,-446.25 9610,-446.25 9610,-482.25\"/>\n", + "<text text-anchor=\"start\" x=\"9214.62\" y=\"-463.95\" font-family=\"Times,serif\" font-size=\"14.00\">GuidedHamiltonian</text>\n", + "<text text-anchor=\"start\" x=\"8966\" y=\"-453.75\" font-family=\"monospace\" font-size=\"10.00\">hamiltonian=KikuchiH ..., guiding_state=BlackBox ..., lambd=19.104, alpha=0.958280 ..., gamma=8.872960 ...</text>\n", + "</g>\n", + "<!-- b0->b1 -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>b0->b1</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9284,-535.26C9284,-523.43 9284,-507.45 9284,-493.75\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9287.5,-493.97 9284,-483.97 9280.5,-493.97 9287.5,-493.97\"/>\n", + "<text text-anchor=\"middle\" x=\"9288.5\" y=\"-504.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b2 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>b2</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9025.75,-393 8966.25,-393 8966.25,-357 9025.75,-357 9025.75,-393\"/>\n", + "<text text-anchor=\"start\" x=\"8974.25\" y=\"-370.32\" font-family=\"Times,serif\" font-size=\"14.00\">ZGate</text>\n", + "</g>\n", + "<!-- b1->b2 -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>b1->b2</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9189.91,-445.79C9167.47,-440.84 9143.72,-434.94 9122,-428.25 9085.24,-416.93 9075,-410.27 9036.6,-393.69\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9038.16,-390.55 9027.59,-389.85 9035.42,-396.99 9038.16,-390.55\"/>\n", + "<text text-anchor=\"middle\" x=\"9171.5\" y=\"-414.95\" font-family=\"Times,serif\" font-size=\"14.00\">11270195255</text>\n", + "</g>\n", + "<!-- b3 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>b3</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9326.12,-393 9043.88,-393 9043.88,-357 9326.12,-357 9326.12,-393\"/>\n", + "<text text-anchor=\"start\" x=\"9051.88\" y=\"-374.7\" font-family=\"Times,serif\" font-size=\"14.00\">GuidedHamiltonianPhaseEstimationā </text>\n", + "<text text-anchor=\"start\" x=\"9125\" y=\"-364.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=GuidedHa ...</text>\n", + "</g>\n", + "<!-- b1->b3 -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>b1->b3</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9264.44,-446.01C9249.66,-432.99 9229.18,-414.93 9212.71,-400.42\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9215.47,-398.19 9205.65,-394.2 9210.84,-403.44 9215.47,-398.19\"/>\n", + "<text text-anchor=\"middle\" x=\"9292.5\" y=\"-414.95\" font-family=\"Times,serif\" font-size=\"14.00\">11270195255</text>\n", + "</g>\n", + "<!-- b4 -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>b4</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9576,-393 9344,-393 9344,-357 9576,-357 9576,-393\"/>\n", + "<text text-anchor=\"start\" x=\"9431.12\" y=\"-374.7\" font-family=\"Times,serif\" font-size=\"14.00\">C[148]Z</text>\n", + "<text text-anchor=\"start\" x=\"9352\" y=\"-364.5\" font-family=\"monospace\" font-size=\"10.00\">cvs=(1, 1, 1 ..., target_gate=cirq.Z</text>\n", + "</g>\n", + "<!-- b1->b4 -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>b1->b4</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9319.19,-445.8C9346.65,-432.19 9385,-413.18 9414.74,-398.44\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9416.11,-401.67 9423.51,-394.09 9413,-395.39 9416.11,-401.67\"/>\n", + "<text text-anchor=\"middle\" x=\"9436.5\" y=\"-414.95\" font-family=\"Times,serif\" font-size=\"14.00\">11270195255</text>\n", + "</g>\n", + "<!-- b5 -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>b5</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10210,-393 9594,-393 9594,-357 10210,-357 10210,-393\"/>\n", + "<text text-anchor=\"start\" x=\"9772.25\" y=\"-374.7\" font-family=\"Times,serif\" font-size=\"14.00\">GuidedHamiltonianPhaseEstimation</text>\n", + "<text text-anchor=\"start\" x=\"9602\" y=\"-364.5\" font-family=\"monospace\" font-size=\"10.00\">hamiltonian=KikuchiH ..., guiding_state=BlackBox ..., precision=0.762791 ..., fail_prob=6.985631 ...</text>\n", + "</g>\n", + "<!-- b1->b5 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>b1->b5</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9407.95,-445.75C9511.91,-431.07 9660.13,-410.15 9767.06,-395.05\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9767.35,-398.55 9776.76,-393.68 9766.37,-391.61 9767.35,-398.55\"/>\n", + "<text text-anchor=\"middle\" x=\"9697.5\" y=\"-414.95\" font-family=\"Times,serif\" font-size=\"14.00\">11270195256</text>\n", + "</g>\n", + "<!-- b6 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>b6</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9900.75,-303.75 9739.25,-303.75 9739.25,-267.75 9900.75,-267.75 9900.75,-303.75\"/>\n", + "<text text-anchor=\"start\" x=\"9747.25\" y=\"-285.45\" font-family=\"Times,serif\" font-size=\"14.00\">QubitizationQPE[7]ā </text>\n", + "<text text-anchor=\"start\" x=\"9760\" y=\"-275.25\" font-family=\"monospace\" font-size=\"10.00\">subbloq=Qubitiza ...</text>\n", + "</g>\n", + "<!-- b3->b6 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>b3->b6</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9326.46,-357.62C9373.16,-352 9425.34,-345.48 9473,-339 9559.52,-327.23 9657.94,-312.26 9727.8,-301.36\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9727.93,-304.89 9737.27,-299.89 9726.85,-297.97 9727.93,-304.89\"/>\n", + "<text text-anchor=\"middle\" x=\"9591.5\" y=\"-325.7\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b7 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>b7</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3602.88,-303.75 3397.12,-303.75 3397.12,-267.75 3602.88,-267.75 3602.88,-303.75\"/>\n", + "<text text-anchor=\"start\" x=\"3405.12\" y=\"-285.45\" font-family=\"Times,serif\" font-size=\"14.00\">BBPrepare[GuidingState]ā </text>\n", + "<text text-anchor=\"start\" x=\"3440\" y=\"-275.25\" font-family=\"monospace\" font-size=\"10.00\">subbloq=BlackBox ...</text>\n", + "</g>\n", + "<!-- b3->b7 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>b3->b7</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9043.71,-357.59C9040.78,-357.38 9037.88,-357.18 9035,-357 7926.28,-287.31 4305.82,-286.2 3614.6,-286.64\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"3614.69,-283.14 3604.69,-286.64 3614.69,-290.14 3614.69,-283.14\"/>\n", + "<text text-anchor=\"middle\" x=\"8585.5\" y=\"-325.7\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b8 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>b8</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9585,-303.75 9335,-303.75 9335,-267.75 9585,-267.75 9585,-303.75\"/>\n", + "<text text-anchor=\"start\" x=\"9409\" y=\"-285.45\" font-family=\"Times,serif\" font-size=\"14.00\">C[148][ZGate]</text>\n", + "<text text-anchor=\"start\" x=\"9343\" y=\"-275.25\" font-family=\"monospace\" font-size=\"10.00\">subbloq=ZGate(), ctrl_spec=CtrlSpec ...</text>\n", + "</g>\n", + "<!-- b4->b8 -->\n", + "<g id=\"edge85\" class=\"edge\">\n", + "<title>b4->b8</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9460,-356.76C9460,-344.93 9460,-328.95 9460,-315.25\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9463.5,-315.47 9460,-305.47 9456.5,-315.47 9463.5,-315.47\"/>\n", + "<text text-anchor=\"middle\" x=\"9464.5\" y=\"-325.7\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b9 -->\n", + "<g id=\"node10\" class=\"node\">\n", + "<title>b9</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11393,-303.75 10963,-303.75 10963,-267.75 11393,-267.75 11393,-303.75\"/>\n", + "<text text-anchor=\"start\" x=\"11108.62\" y=\"-285.45\" font-family=\"Times,serif\" font-size=\"14.00\">QubitizationQPE[7]</text>\n", + "<text text-anchor=\"start\" x=\"10971\" y=\"-275.25\" font-family=\"monospace\" font-size=\"10.00\">walk=Qubitize ..., ctrl_state_prep=KaiserWi ..., qft_inv=Adjoint( ...</text>\n", + "</g>\n", + "<!-- b5->b9 -->\n", + "<g id=\"edge93\" class=\"edge\">\n", + "<title>b5->b9</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10157.92,-356.5C10389.99,-340.63 10728.84,-317.46 10951.34,-302.25\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10951.26,-305.76 10961,-301.59 10950.79,-298.78 10951.26,-305.76\"/>\n", + "<text text-anchor=\"middle\" x=\"10658.5\" y=\"-325.7\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b10 -->\n", + "<g id=\"node11\" class=\"node\">\n", + "<title>b10</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"7484.5,-303.75 7285.5,-303.75 7285.5,-267.75 7484.5,-267.75 7484.5,-303.75\"/>\n", + "<text text-anchor=\"start\" x=\"7293.5\" y=\"-285.45\" font-family=\"Times,serif\" font-size=\"14.00\">BBPrepare[GuidingState]</text>\n", + "<text text-anchor=\"start\" x=\"7325\" y=\"-275.25\" font-family=\"monospace\" font-size=\"10.00\">prepare=GuidingS ...</text>\n", + "</g>\n", + "<!-- b5->b10 -->\n", + "<g id=\"edge94\" class=\"edge\">\n", + "<title>b5->b10</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9821.38,-356.54C9760.81,-344.27 9675.62,-328.85 9600,-321.75 9390.17,-302.06 7915.86,-290.43 7496.21,-287.49\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"7496.53,-283.99 7486.51,-287.42 7496.48,-290.99 7496.53,-283.99\"/>\n", + "<text text-anchor=\"middle\" x=\"9729.5\" y=\"-325.7\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b11 -->\n", + "<g id=\"node12\" class=\"node\">\n", + "<title>b11</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10080,-214.5 9800,-214.5 9800,-178.5 10080,-178.5 10080,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"9909.62\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">C[B[H]ā ]</text>\n", + "<text text-anchor=\"start\" x=\"9808\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">subbloq=Adjoint( ..., ctrl_spec=CtrlSpec ...</text>\n", + "</g>\n", + "<!-- b6->b11 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>b6->b11</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9844,-267.3C9862.06,-254.17 9887.04,-236 9906.99,-221.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9908.79,-224.52 9914.82,-215.81 9904.68,-218.86 9908.79,-224.52\"/>\n", + "<text text-anchor=\"middle\" x=\"9894.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b12 -->\n", + "<g id=\"node13\" class=\"node\">\n", + "<title>b12</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"6400,-214.5 6216,-214.5 6216,-178.5 6400,-178.5 6400,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"6259.62\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">QFTTextBook</text>\n", + "<text text-anchor=\"start\" x=\"6224\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">bitsize=7, with_reverse=True</text>\n", + "</g>\n", + "<!-- b6->b12 -->\n", + "<g id=\"edge9\" class=\"edge\">\n", + "<title>b6->b12</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9738.97,-279.44C9663.23,-273.94 9547.11,-264.11 9447,-249.75 9407.12,-244.03 9398.08,-236.58 9358,-232.5 9060.38,-202.2 6911.75,-198.12 6411.77,-197.58\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"6411.79,-194.08 6401.78,-197.57 6411.78,-201.08 6411.79,-194.08\"/>\n", + "<text text-anchor=\"middle\" x=\"9451.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b13 -->\n", + "<g id=\"node14\" class=\"node\">\n", + "<title>b13</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11351,-214.5 11215,-214.5 11215,-178.5 11351,-178.5 11351,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"11263.12\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">B[H]ā </text>\n", + "<text text-anchor=\"start\" x=\"11223\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">subbloq=Qubitize ...</text>\n", + "</g>\n", + "<!-- b6->b13 -->\n", + "<g id=\"edge10\" class=\"edge\">\n", + "<title>b6->b13</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9901.03,-284.24C10073.71,-282.66 10490.62,-276.19 10839,-249.75 10966.9,-240.04 11114.69,-221.1 11203.4,-208.88\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11203.79,-212.36 11213.22,-207.52 11202.83,-205.43 11203.79,-212.36\"/>\n", + "<text text-anchor=\"middle\" x=\"11023.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">126</text>\n", + "</g>\n", + "<!-- b14 -->\n", + "<g id=\"node15\" class=\"node\">\n", + "<title>b14</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9781.88,-214.5 9618.12,-214.5 9618.12,-178.5 9781.88,-178.5 9781.88,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"9626.12\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">KaiserWindowStateā </text>\n", + "<text text-anchor=\"start\" x=\"9640\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">subbloq=KaiserWi ...</text>\n", + "</g>\n", + "<!-- b6->b14 -->\n", + "<g id=\"edge12\" class=\"edge\">\n", + "<title>b6->b14</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9796,-267.3C9777.94,-254.17 9752.96,-236 9733.01,-221.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9735.32,-218.86 9725.18,-215.81 9731.21,-224.52 9735.32,-218.86\"/>\n", + "<text text-anchor=\"middle\" x=\"9774.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b22 -->\n", + "<g id=\"node23\" class=\"node\">\n", + "<title>b22</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11146,-125.25 10722,-125.25 10722,-89.25 11146,-89.25 11146,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"10848.88\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">ReflectionUsingPrepare</text>\n", + "<text text-anchor=\"start\" x=\"10730\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">prepare_gate=BlackBox ..., control_val=0, global_phase=-1, eps=1e-11</text>\n", + "</g>\n", + "<!-- b6->b22 -->\n", + "<g id=\"edge11\" class=\"edge\">\n", + "<title>b6->b22</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9900.95,-283.65C10130.25,-280.28 10770.24,-269.2 10811,-249.75 10837.43,-237.14 10887.46,-172.36 10914.87,-134.97\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10917.7,-137.03 10920.75,-126.88 10912.04,-132.91 10917.7,-137.03\"/>\n", + "<text text-anchor=\"middle\" x=\"10890\" y=\"-191.82\" font-family=\"Times,serif\" font-size=\"14.00\">12</text>\n", + "</g>\n", + "<!-- b15 -->\n", + "<g id=\"node16\" class=\"node\">\n", + "<title>b15</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1462,-214.5 1326,-214.5 1326,-178.5 1462,-178.5 1462,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"1343.38\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">GuidingStateā </text>\n", + "<text text-anchor=\"start\" x=\"1334\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">subbloq=AutoPart ...</text>\n", + "</g>\n", + "<!-- b7->b15 -->\n", + "<g id=\"edge73\" class=\"edge\">\n", + "<title>b7->b15</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M3396.68,-282.98C3040.9,-276.6 1867.89,-253.07 1493,-214.5 1486.61,-213.84 1480.01,-213.02 1473.39,-212.1\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1474.17,-208.68 1463.77,-210.68 1473.15,-215.6 1474.17,-208.68\"/>\n", + "<text text-anchor=\"middle\" x=\"2075.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b16 -->\n", + "<g id=\"node17\" class=\"node\">\n", + "<title>b16</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9600,-214.5 9546,-214.5 9546,-178.5 9600,-178.5 9600,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"9562.88\" y=\"-191.82\" font-family=\"Times,serif\" font-size=\"14.00\">CZ</text>\n", + "</g>\n", + "<!-- b8->b16 -->\n", + "<g id=\"edge86\" class=\"edge\">\n", + "<title>b8->b16</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9482.6,-267.3C9499.46,-254.29 9522.71,-236.33 9541.41,-221.89\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9543.47,-224.72 9549.25,-215.84 9539.19,-219.18 9543.47,-224.72\"/>\n", + "<text text-anchor=\"middle\" x=\"9530.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b17 -->\n", + "<g id=\"node18\" class=\"node\">\n", + "<title>b17</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9374,-214.5 9226,-214.5 9226,-178.5 9374,-178.5 9374,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"9255\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">CtrlSpecAnd</text>\n", + "<text text-anchor=\"start\" x=\"9234\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">ctrl_spec=CtrlSpec ...</text>\n", + "</g>\n", + "<!-- b8->b17 -->\n", + "<g id=\"edge87\" class=\"edge\">\n", + "<title>b8->b17</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9385.98,-267.26C9373.13,-262.62 9360.29,-256.85 9349,-249.75 9337.99,-242.83 9327.8,-232.84 9319.59,-223.45\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9322.42,-221.37 9313.34,-215.91 9317.03,-225.84 9322.42,-221.37\"/>\n", + "<text text-anchor=\"middle\" x=\"9353.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b18 -->\n", + "<g id=\"node19\" class=\"node\">\n", + "<title>b18</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9528,-214.5 9392,-214.5 9392,-178.5 9528,-178.5 9528,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"9411.62\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">CtrlSpecAndā </text>\n", + "<text text-anchor=\"start\" x=\"9400\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">subbloq=CtrlSpec ...</text>\n", + "</g>\n", + "<!-- b8->b18 -->\n", + "<g id=\"edge88\" class=\"edge\">\n", + "<title>b8->b18</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9460,-267.51C9460,-255.68 9460,-239.7 9460,-226\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9463.5,-226.22 9460,-216.22 9456.5,-226.22 9463.5,-226.22\"/>\n", + "<text text-anchor=\"middle\" x=\"9464.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b19 -->\n", + "<g id=\"node20\" class=\"node\">\n", + "<title>b19</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"12841,-214.5 12651,-214.5 12651,-178.5 12841,-178.5 12841,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"12675.5\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">KaiserWindowState</text>\n", + "<text text-anchor=\"start\" x=\"12659\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">bitsize=7, alpha=22.10225 ...</text>\n", + "</g>\n", + "<!-- b9->b19 -->\n", + "<g id=\"edge95\" class=\"edge\">\n", + "<title>b9->b19</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11393.15,-272.78C11733.62,-253.83 12384.12,-217.64 12639.41,-203.43\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12639.6,-206.93 12649.39,-202.88 12639.21,-199.94 12639.6,-206.93\"/>\n", + "<text text-anchor=\"middle\" x=\"12106.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b20 -->\n", + "<g id=\"node21\" class=\"node\">\n", + "<title>b20</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"19326,-214.5 19190,-214.5 19190,-178.5 19326,-178.5 19326,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"19206.25\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">QFTTextBookā </text>\n", + "<text text-anchor=\"start\" x=\"19198\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">subbloq=QFTTextB ...</text>\n", + "</g>\n", + "<!-- b9->b20 -->\n", + "<g id=\"edge96\" class=\"edge\">\n", + "<title>b9->b20</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11393.34,-282.42C12593.16,-269.47 18426.39,-206.48 19178.15,-198.36\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"19178.15,-201.86 19188.11,-198.25 19178.08,-194.86 19178.15,-201.86\"/>\n", + "<text text-anchor=\"middle\" x=\"15945.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b21 -->\n", + "<g id=\"node22\" class=\"node\">\n", + "<title>b21</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11547,-214.5 11369,-214.5 11369,-178.5 11547,-178.5 11547,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"11441.5\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">B[H]</text>\n", + "<text text-anchor=\"start\" x=\"11377\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">block_encoding=KikuchiH ...</text>\n", + "</g>\n", + "<!-- b9->b21 -->\n", + "<g id=\"edge97\" class=\"edge\">\n", + "<title>b9->b21</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11233.99,-267.3C11279.3,-253.19 11343.23,-233.26 11391.2,-218.31\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11392.16,-221.68 11400.66,-215.37 11390.07,-215 11392.16,-221.68\"/>\n", + "<text text-anchor=\"middle\" x=\"11356.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">126</text>\n", + "</g>\n", + "<!-- b9->b22 -->\n", + "<g id=\"edge98\" class=\"edge\">\n", + "<title>b9->b22</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11154.16,-267.51C11110.34,-235.81 11016.91,-168.22 10967.02,-132.13\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10969.32,-129.48 10959.16,-126.45 10965.21,-135.15 10969.32,-129.48\"/>\n", + "<text text-anchor=\"middle\" x=\"11089\" y=\"-191.82\" font-family=\"Times,serif\" font-size=\"14.00\">12</text>\n", + "</g>\n", + "<!-- b23 -->\n", + "<g id=\"node24\" class=\"node\">\n", + "<title>b23</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10632,-214.5 10352,-214.5 10352,-178.5 10632,-178.5 10632,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"10465\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">C[B[H]]</text>\n", + "<text text-anchor=\"start\" x=\"10360\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">subbloq=Qubitize ..., ctrl_spec=CtrlSpec ...</text>\n", + "</g>\n", + "<!-- b9->b23 -->\n", + "<g id=\"edge99\" class=\"edge\">\n", + "<title>b9->b23</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11040.41,-267.25C10924.66,-252.53 10759.49,-231.52 10640.7,-216.41\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10641.22,-212.95 10630.86,-215.16 10640.34,-219.89 10641.22,-212.95\"/>\n", + "<text text-anchor=\"middle\" x=\"10900.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b24 -->\n", + "<g id=\"node25\" class=\"node\">\n", + "<title>b24</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1872,-214.5 1502,-214.5 1502,-178.5 1872,-178.5 1872,-214.5\"/>\n", + "<text text-anchor=\"start\" x=\"1639.75\" y=\"-196.2\" font-family=\"Times,serif\" font-size=\"14.00\">GuidingState</text>\n", + "<text text-anchor=\"start\" x=\"1510\" y=\"-186\" font-family=\"monospace\" font-size=\"10.00\">bloq=GuidingS ..., partitions=((Regist ..., left_only=False</text>\n", + "</g>\n", + "<!-- b10->b24 -->\n", + "<g id=\"edge147\" class=\"edge\">\n", + "<title>b10->b24</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M7285.2,-283.22C6617.51,-273 2797.99,-214.51 1883.64,-200.51\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1883.93,-197.02 1873.88,-200.36 1883.82,-204.01 1883.93,-197.02\"/>\n", + "<text text-anchor=\"middle\" x=\"5051.5\" y=\"-236.45\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b25 -->\n", + "<g id=\"node26\" class=\"node\">\n", + "<title>b25</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9964,-125.25 9684,-125.25 9684,-89.25 9964,-89.25 9964,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"9793.62\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">C[B[H]ā ]</text>\n", + "<text text-anchor=\"start\" x=\"9692\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=Adjoint( ..., ctrl_spec=CtrlSpec ...</text>\n", + "</g>\n", + "<!-- b11->b25 -->\n", + "<g id=\"edge14\" class=\"edge\">\n", + "<title>b11->b25</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9916.8,-178.05C9899.42,-164.98 9875.41,-146.92 9856.17,-132.45\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9858.46,-129.79 9848.36,-126.58 9854.25,-135.38 9858.46,-129.79\"/>\n", + "<text text-anchor=\"middle\" x=\"9896.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b49 -->\n", + "<g id=\"node50\" class=\"node\">\n", + "<title>b49</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10704,-125.25 10280,-125.25 10280,-89.25 10704,-89.25 10704,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"10406.88\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">ReflectionUsingPrepare</text>\n", + "<text text-anchor=\"start\" x=\"10288\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">prepare_gate=BlackBox ..., control_val=1, global_phase=-1, eps=1e-11</text>\n", + "</g>\n", + "<!-- b11->b49 -->\n", + "<g id=\"edge13\" class=\"edge\">\n", + "<title>b11->b49</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10080.17,-184.36C10138.48,-178.74 10206.74,-170.87 10268,-160.5 10295.15,-155.9 10358.08,-141.09 10410.34,-128.4\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10410.96,-131.86 10419.85,-126.09 10409.3,-125.06 10410.96,-131.86\"/>\n", + "<text text-anchor=\"middle\" x=\"10348.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b26 -->\n", + "<g id=\"node27\" class=\"node\">\n", + "<title>b26</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2305,-125.25 1965,-125.25 1965,-89.25 2305,-89.25 2305,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"2054.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitary</text>\n", + "<text text-anchor=\"start\" x=\"1973\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">bitsize=1, exponent=0.5, is_controlled=True, eps=1e-10</text>\n", + "</g>\n", + "<!-- b12->b26 -->\n", + "<g id=\"edge21\" class=\"edge\">\n", + "<title>b12->b26</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6215.72,-194.88C5696.44,-191.24 3133.29,-171.23 2316.35,-125.35\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"2316.74,-121.87 2306.55,-124.79 2316.34,-128.86 2316.74,-121.87\"/>\n", + "<text text-anchor=\"middle\" x=\"3367.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b27 -->\n", + "<g id=\"node28\" class=\"node\">\n", + "<title>b27</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2663,-125.25 2323,-125.25 2323,-89.25 2663,-89.25 2663,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"2412.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitary</text>\n", + "<text text-anchor=\"start\" x=\"2331\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">bitsize=5, exponent=0.5, is_controlled=True, eps=1e-10</text>\n", + "</g>\n", + "<!-- b12->b27 -->\n", + "<g id=\"edge22\" class=\"edge\">\n", + "<title>b12->b27</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6215.59,-193.39C5717.72,-182 3352.32,-127.9 2674.76,-112.41\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"2675.03,-108.91 2664.95,-112.18 2674.87,-115.91 2675.03,-108.91\"/>\n", + "<text text-anchor=\"middle\" x=\"4747.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b28 -->\n", + "<g id=\"node29\" class=\"node\">\n", + "<title>b28</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"4173,-125.25 3833,-125.25 3833,-89.25 4173,-89.25 4173,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"3922.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitary</text>\n", + "<text text-anchor=\"start\" x=\"3841\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">bitsize=6, exponent=0.5, is_controlled=True, eps=1e-10</text>\n", + "</g>\n", + "<!-- b12->b28 -->\n", + "<g id=\"edge23\" class=\"edge\">\n", + "<title>b12->b28</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6215.5,-192C5869.7,-178.91 4649.01,-132.7 4184.38,-115.12\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"4184.85,-111.63 4174.72,-114.75 4184.58,-118.63 4184.85,-111.63\"/>\n", + "<text text-anchor=\"middle\" x=\"5366.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b29 -->\n", + "<g id=\"node30\" class=\"node\">\n", + "<title>b29</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"5738,-125.25 5398,-125.25 5398,-89.25 5738,-89.25 5738,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"5487.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitary</text>\n", + "<text text-anchor=\"start\" x=\"5406\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">bitsize=4, exponent=0.5, is_controlled=True, eps=1e-10</text>\n", + "</g>\n", + "<!-- b12->b29 -->\n", + "<g id=\"edge24\" class=\"edge\">\n", + "<title>b12->b29</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6215.77,-184.63C6093.59,-170.22 5876.17,-144.59 5727.19,-127.02\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"5727.98,-123.59 5717.64,-125.89 5727.16,-130.54 5727.98,-123.59\"/>\n", + "<text text-anchor=\"middle\" x=\"6009.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b30 -->\n", + "<g id=\"node31\" class=\"node\">\n", + "<title>b30</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"6478,-125.25 6138,-125.25 6138,-89.25 6478,-89.25 6478,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"6227.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitary</text>\n", + "<text text-anchor=\"start\" x=\"6146\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">bitsize=2, exponent=0.5, is_controlled=True, eps=1e-10</text>\n", + "</g>\n", + "<!-- b12->b30 -->\n", + "<g id=\"edge25\" class=\"edge\">\n", + "<title>b12->b30</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6308,-178.26C6308,-166.43 6308,-150.45 6308,-136.75\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"6311.5,-136.97 6308,-126.97 6304.5,-136.97 6311.5,-136.97\"/>\n", + "<text text-anchor=\"middle\" x=\"6312.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b31 -->\n", + "<g id=\"node32\" class=\"node\">\n", + "<title>b31</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"7093,-125.25 6753,-125.25 6753,-89.25 7093,-89.25 7093,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"6842.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitary</text>\n", + "<text text-anchor=\"start\" x=\"6761\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">bitsize=3, exponent=0.5, is_controlled=True, eps=1e-10</text>\n", + "</g>\n", + "<!-- b12->b31 -->\n", + "<g id=\"edge27\" class=\"edge\">\n", + "<title>b12->b31</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6400.4,-182.39C6503.46,-167.77 6671.1,-143.99 6788.65,-127.31\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"6788.96,-130.8 6798.37,-125.93 6787.97,-123.87 6788.96,-130.8\"/>\n", + "<text text-anchor=\"middle\" x=\"6675.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b38 -->\n", + "<g id=\"node39\" class=\"node\">\n", + "<title>b38</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9197.5,-125.25 9106.5,-125.25 9106.5,-89.25 9197.5,-89.25 9197.5,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"9114.5\" y=\"-102.58\" font-family=\"Times,serif\" font-size=\"14.00\">Hadamard</text>\n", + "</g>\n", + "<!-- b12->b38 -->\n", + "<g id=\"edge20\" class=\"edge\">\n", + "<title>b12->b38</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6400.42,-195.19C6741.36,-193.58 7960.71,-183.82 8964,-125.25 9008.03,-122.68 9057.72,-118.11 9094.95,-114.36\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9094.99,-117.88 9104.58,-113.38 9094.28,-110.91 9094.99,-117.88\"/>\n", + "<text text-anchor=\"middle\" x=\"8607.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">7</text>\n", + "</g>\n", + "<!-- b45 -->\n", + "<g id=\"node46\" class=\"node\">\n", + "<title>b45</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9479.62,-125.25 9374.38,-125.25 9374.38,-89.25 9479.62,-89.25 9479.62,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"9382.38\" y=\"-102.58\" font-family=\"Times,serif\" font-size=\"14.00\">TwoBitSwap</text>\n", + "</g>\n", + "<!-- b12->b45 -->\n", + "<g id=\"edge26\" class=\"edge\">\n", + "<title>b12->b45</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6400.35,-195.5C6890.18,-195.39 9167.67,-193.11 9313,-160.5 9339.29,-154.6 9366.8,-142.2 9388.21,-130.95\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9389.73,-134.11 9396.87,-126.28 9386.4,-127.95 9389.73,-134.11\"/>\n", + "<text text-anchor=\"middle\" x=\"9365.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">3</text>\n", + "</g>\n", + "<!-- b32 -->\n", + "<g id=\"node33\" class=\"node\">\n", + "<title>b32</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11772,-125.25 11636,-125.25 11636,-89.25 11772,-89.25 11772,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"11684.12\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">B[H]ā </text>\n", + "<text text-anchor=\"start\" x=\"11644\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=KikuchiH ...</text>\n", + "</g>\n", + "<!-- b13->b32 -->\n", + "<g id=\"edge49\" class=\"edge\">\n", + "<title>b13->b32</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11318.85,-178.05C11347.26,-164.52 11384.77,-147.4 11401,-143.25 11493.47,-119.6 11520.44,-138.22 11615,-125.25 11618.04,-124.83 11621.13,-124.38 11624.24,-123.9\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11624.8,-127.36 11634.11,-122.3 11623.68,-120.45 11624.8,-127.36\"/>\n", + "<text text-anchor=\"middle\" x=\"11405.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b47 -->\n", + "<g id=\"node48\" class=\"node\">\n", + "<title>b47</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11606,-125.25 11164,-125.25 11164,-89.25 11606,-89.25 11606,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"11299.88\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">ReflectionUsingPrepare</text>\n", + "<text text-anchor=\"start\" x=\"11172\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">prepare_gate=BlackBox ..., control_val=None, global_phase=-1, eps=1e-11</text>\n", + "</g>\n", + "<!-- b13->b47 -->\n", + "<g id=\"edge50\" class=\"edge\">\n", + "<title>b13->b47</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11303.15,-178.26C11318.38,-165.24 11339.48,-147.18 11356.45,-132.67\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11358.42,-135.6 11363.74,-126.44 11353.87,-130.28 11358.42,-135.6\"/>\n", + "<text text-anchor=\"middle\" x=\"11347.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b33 -->\n", + "<g id=\"node34\" class=\"node\">\n", + "<title>b33</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"8955.25,-125.25 8718.75,-125.25 8718.75,-89.25 8955.25,-89.25 8955.25,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"8726.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">StatePreparationViaRotationsā </text>\n", + "<text text-anchor=\"start\" x=\"8777\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=StatePre ...</text>\n", + "</g>\n", + "<!-- b14->b33 -->\n", + "<g id=\"edge61\" class=\"edge\">\n", + "<title>b14->b33</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9660.18,-178.12C9630.23,-165.94 9587.84,-150.58 9549,-143.25 9450.44,-124.65 9198.16,-130.51 9098,-125.25 9055.32,-123.01 9008.74,-120.12 8966.9,-117.36\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"8967.24,-113.87 8957.03,-116.7 8966.78,-120.86 8967.24,-113.87\"/>\n", + "<text text-anchor=\"middle\" x=\"9616.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b34 -->\n", + "<g id=\"node35\" class=\"node\">\n", + "<title>b34</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"613,-125.25 477,-125.25 477,-89.25 613,-89.25 613,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"494.38\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">GuidingStateā </text>\n", + "<text text-anchor=\"start\" x=\"485\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=GuidingS ...</text>\n", + "</g>\n", + "<!-- b15->b34 -->\n", + "<g id=\"edge75\" class=\"edge\">\n", + "<title>b15->b34</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1325.6,-188.47C1169.95,-172.47 789.99,-133.43 624.36,-116.41\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"625.1,-112.96 614.8,-115.42 624.39,-119.93 625.1,-112.96\"/>\n", + "<text text-anchor=\"middle\" x=\"1050.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b51 -->\n", + "<g id=\"node52\" class=\"node\">\n", + "<title>b51</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1673,-125.25 1423,-125.25 1423,-89.25 1673,-89.25 1673,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"1516.88\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">Partition</text>\n", + "<text text-anchor=\"start\" x=\"1431\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">n=56, regs=(Registe ..., partition=True</text>\n", + "</g>\n", + "<!-- b15->b51 -->\n", + "<g id=\"edge74\" class=\"edge\">\n", + "<title>b15->b51</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1424.79,-178.05C1448.51,-164.62 1481.49,-145.93 1507.37,-131.27\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1508.97,-134.39 1515.94,-126.41 1505.52,-128.3 1508.97,-134.39\"/>\n", + "<text text-anchor=\"middle\" x=\"1489.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b52 -->\n", + "<g id=\"node53\" class=\"node\">\n", + "<title>b52</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1137,-125.25 881,-125.25 881,-89.25 1137,-89.25 1137,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"977.88\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">Partition</text>\n", + "<text text-anchor=\"start\" x=\"889\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">n=27, regs=(Registe ..., partition=False</text>\n", + "</g>\n", + "<!-- b15->b52 -->\n", + "<g id=\"edge76\" class=\"edge\">\n", + "<title>b15->b52</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1325.61,-180C1261.82,-165.55 1166.34,-143.91 1096.91,-128.17\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1098.01,-124.83 1087.48,-126.04 1096.46,-131.66 1098.01,-124.83\"/>\n", + "<text text-anchor=\"middle\" x=\"1240.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b53 -->\n", + "<g id=\"node54\" class=\"node\">\n", + "<title>b53</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1405,-125.25 1155,-125.25 1155,-89.25 1405,-89.25 1405,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"1248.88\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">Partition</text>\n", + "<text text-anchor=\"start\" x=\"1163\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">n=27, regs=(Registe ..., partition=True</text>\n", + "</g>\n", + "<!-- b15->b53 -->\n", + "<g id=\"edge77\" class=\"edge\">\n", + "<title>b15->b53</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1371.2,-178.05C1354.2,-165.04 1330.74,-147.08 1311.87,-132.64\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1314.03,-129.88 1303.96,-126.59 1309.77,-135.44 1314.03,-129.88\"/>\n", + "<text text-anchor=\"middle\" x=\"1352.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b54 -->\n", + "<g id=\"node55\" class=\"node\">\n", + "<title>b54</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1947,-125.25 1691,-125.25 1691,-89.25 1947,-89.25 1947,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"1787.88\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">Partition</text>\n", + "<text text-anchor=\"start\" x=\"1699\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">n=56, regs=(Registe ..., partition=False</text>\n", + "</g>\n", + "<!-- b15->b54 -->\n", + "<g id=\"edge78\" class=\"edge\">\n", + "<title>b15->b54</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1453.71,-178.1C1493.03,-167.07 1545.79,-153.08 1593,-143.25 1621,-137.42 1651.15,-132.1 1680,-127.46\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1680.17,-130.98 1689.5,-125.96 1679.08,-124.07 1680.17,-130.98\"/>\n", + "<text text-anchor=\"middle\" x=\"1597.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b35 -->\n", + "<g id=\"node36\" class=\"node\">\n", + "<title>b35</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9356,-125.25 9244,-125.25 9244,-89.25 9356,-89.25 9356,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"9267\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">MultiAnd</text>\n", + "<text text-anchor=\"start\" x=\"9252\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">cvs=(1, 1, 1 ...</text>\n", + "</g>\n", + "<!-- b17->b35 -->\n", + "<g id=\"edge89\" class=\"edge\">\n", + "<title>b17->b35</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9300,-178.26C9300,-166.43 9300,-150.45 9300,-136.75\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9303.5,-136.97 9300,-126.97 9296.5,-136.97 9303.5,-136.97\"/>\n", + "<text text-anchor=\"middle\" x=\"9304.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b36 -->\n", + "<g id=\"node37\" class=\"node\">\n", + "<title>b36</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9634,-125.25 9498,-125.25 9498,-89.25 9634,-89.25 9634,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"9529.62\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">MultiAndā </text>\n", + "<text text-anchor=\"start\" x=\"9506\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=MultiAnd ...</text>\n", + "</g>\n", + "<!-- b18->b36 -->\n", + "<g id=\"edge91\" class=\"edge\">\n", + "<title>b18->b36</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9472.49,-178.17C9480.88,-167.3 9492.63,-153.47 9505,-143.25 9510.07,-139.07 9515.7,-135.09 9521.43,-131.43\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9523.07,-134.53 9529.81,-126.36 9519.44,-128.55 9523.07,-134.53\"/>\n", + "<text text-anchor=\"middle\" x=\"9509.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b37 -->\n", + "<g id=\"node38\" class=\"node\">\n", + "<title>b37</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"14783,-125.25 14263,-125.25 14263,-89.25 14783,-89.25 14783,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"14416.12\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">StatePreparationViaRotations</text>\n", + "<text text-anchor=\"start\" x=\"14271\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">state_coefficients=(3.94567 ..., phase_bitsize=7, control_bitsize=0, uncompute=False</text>\n", + "</g>\n", + "<!-- b19->b37 -->\n", + "<g id=\"edge100\" class=\"edge\">\n", + "<title>b19->b37</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12841.22,-190.82C13104.02,-177.92 13846.67,-141.46 14251.56,-121.58\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"14251.52,-125.08 14261.34,-121.1 14251.18,-118.09 14251.52,-125.08\"/>\n", + "<text text-anchor=\"middle\" x=\"13797.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b20->b38 -->\n", + "<g id=\"edge112\" class=\"edge\">\n", + "<title>b20->b38</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19189.59,-195.36C18368.86,-193.73 10438.92,-177.48 10383,-160.5 10369.73,-156.47 10370.24,-147.36 10357,-143.25 10297.46,-124.77 9296.97,-132.03 9235,-125.25 9226.56,-124.33 9217.71,-122.96 9209.06,-121.39\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9209.82,-117.97 9199.34,-119.51 9208.5,-124.84 9209.82,-117.97\"/>\n", + "<text text-anchor=\"middle\" x=\"10387.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">7</text>\n", + "</g>\n", + "<!-- b39 -->\n", + "<g id=\"node40\" class=\"node\">\n", + "<title>b39</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"18383.62,-125.25 18200.38,-125.25 18200.38,-89.25 18383.62,-89.25 18383.62,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"18208.38\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitaryā </text>\n", + "<text text-anchor=\"start\" x=\"18232\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PhaseGra ...</text>\n", + "</g>\n", + "<!-- b20->b39 -->\n", + "<g id=\"edge113\" class=\"edge\">\n", + "<title>b20->b39</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19189.69,-189.33C19022.76,-174.25 18593.37,-135.47 18395.13,-117.56\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"18395.63,-114.1 18385.36,-116.68 18395,-121.07 18395.63,-114.1\"/>\n", + "<text text-anchor=\"middle\" x=\"18865.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b40 -->\n", + "<g id=\"node41\" class=\"node\">\n", + "<title>b40</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"19349.62,-125.25 19166.38,-125.25 19166.38,-89.25 19349.62,-89.25 19349.62,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"19174.38\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitaryā </text>\n", + "<text text-anchor=\"start\" x=\"19198\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PhaseGra ...</text>\n", + "</g>\n", + "<!-- b20->b40 -->\n", + "<g id=\"edge114\" class=\"edge\">\n", + "<title>b20->b40</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19258,-178.26C19258,-166.43 19258,-150.45 19258,-136.75\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"19261.5,-136.97 19258,-126.97 19254.5,-136.97 19261.5,-136.97\"/>\n", + "<text text-anchor=\"middle\" x=\"19262.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b41 -->\n", + "<g id=\"node42\" class=\"node\">\n", + "<title>b41</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"20539.62,-125.25 20356.38,-125.25 20356.38,-89.25 20539.62,-89.25 20539.62,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"20364.38\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitaryā </text>\n", + "<text text-anchor=\"start\" x=\"20388\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PhaseGra ...</text>\n", + "</g>\n", + "<!-- b20->b41 -->\n", + "<g id=\"edge115\" class=\"edge\">\n", + "<title>b20->b41</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19326.25,-190.5C19525.48,-175.89 20107.1,-133.24 20344.88,-115.81\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"20345.06,-119.31 20354.78,-115.09 20344.55,-112.33 20345.06,-119.31\"/>\n", + "<text text-anchor=\"middle\" x=\"19963.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b42 -->\n", + "<g id=\"node43\" class=\"node\">\n", + "<title>b42</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"21294.62,-125.25 21111.38,-125.25 21111.38,-89.25 21294.62,-89.25 21294.62,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"21119.38\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitaryā </text>\n", + "<text text-anchor=\"start\" x=\"21143\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PhaseGra ...</text>\n", + "</g>\n", + "<!-- b20->b42 -->\n", + "<g id=\"edge116\" class=\"edge\">\n", + "<title>b20->b42</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19326.37,-192.43C19616.85,-179.4 20749.78,-128.58 21099.56,-112.89\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"21099.58,-116.39 21109.41,-112.45 21099.27,-109.4 21099.58,-116.39\"/>\n", + "<text text-anchor=\"middle\" x=\"20408.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b43 -->\n", + "<g id=\"node44\" class=\"node\">\n", + "<title>b43</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"21985.62,-125.25 21802.38,-125.25 21802.38,-89.25 21985.62,-89.25 21985.62,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"21810.38\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitaryā </text>\n", + "<text text-anchor=\"start\" x=\"21834\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PhaseGra ...</text>\n", + "</g>\n", + "<!-- b20->b43 -->\n", + "<g id=\"edge117\" class=\"edge\">\n", + "<title>b20->b43</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19326.26,-193.56C19505.22,-188.45 20002.78,-174.08 20417,-160.5 20932.92,-143.58 21550.13,-120.99 21790.8,-112.08\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"21790.6,-115.59 21800.46,-111.73 21790.34,-108.6 21790.6,-115.59\"/>\n", + "<text text-anchor=\"middle\" x=\"20908.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b44 -->\n", + "<g id=\"node45\" class=\"node\">\n", + "<title>b44</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"23279.62,-125.25 23096.38,-125.25 23096.38,-89.25 23279.62,-89.25 23279.62,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"23104.38\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">PhaseGradientUnitaryā </text>\n", + "<text text-anchor=\"start\" x=\"23128\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PhaseGra ...</text>\n", + "</g>\n", + "<!-- b20->b44 -->\n", + "<g id=\"edge118\" class=\"edge\">\n", + "<title>b20->b44</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19326.35,-194.1C19552.85,-189.47 20299.57,-174.12 20917,-160.5 21753.79,-142.05 22763.98,-118.28 23084.94,-110.69\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"23084.63,-114.2 23094.55,-110.46 23084.47,-107.2 23084.63,-114.2\"/>\n", + "<text text-anchor=\"middle\" x=\"21670.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b20->b45 -->\n", + "<g id=\"edge119\" class=\"edge\">\n", + "<title>b20->b45</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19189.55,-195.32C18376.64,-193.18 10593.95,-172.41 10479,-160.5 10441.09,-156.57 10432.88,-147.48 10395,-143.25 10198.39,-121.3 9706.01,-152.95 9491.18,-125.23\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9491.8,-121.78 9481.42,-123.89 9490.85,-128.72 9491.8,-121.78\"/>\n", + "<text text-anchor=\"middle\" x=\"10483.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">3</text>\n", + "</g>\n", + "<!-- b46 -->\n", + "<g id=\"node47\" class=\"node\">\n", + "<title>b46</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"12152,-125.25 11848,-125.25 11848,-89.25 12152,-89.25 12152,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"11983.5\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">B[H]</text>\n", + "<text text-anchor=\"start\" x=\"11856\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">inst=KXorInst ..., ell=8, entry_bitsize=10, s=24</text>\n", + "</g>\n", + "<!-- b21->b46 -->\n", + "<g id=\"edge141\" class=\"edge\">\n", + "<title>b21->b46</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11547.2,-181.14C11638.14,-166.5 11779.79,-143.7 11880.42,-127.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11880.75,-130.99 11890.06,-125.95 11879.63,-124.08 11880.75,-130.99\"/>\n", + "<text text-anchor=\"middle\" x=\"11781.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b21->b47 -->\n", + "<g id=\"edge142\" class=\"edge\">\n", + "<title>b21->b47</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11443.58,-178.26C11432.98,-165.6 11418.4,-148.17 11406.44,-133.88\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11409.47,-132.04 11400.36,-126.61 11404.1,-136.53 11409.47,-132.04\"/>\n", + "<text text-anchor=\"middle\" x=\"11432.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b48 -->\n", + "<g id=\"node49\" class=\"node\">\n", + "<title>b48</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11358,-36 11096,-36 11096,0 11358,0 11358,-36\"/>\n", + "<text text-anchor=\"start\" x=\"11190.62\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">ZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"11104\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-1.0, global_shift=-1, eps=1e-11</text>\n", + "</g>\n", + "<!-- b22->b48 -->\n", + "<g id=\"edge58\" class=\"edge\">\n", + "<title>b22->b48</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11045.97,-88.82C11068.74,-84.07 11092.34,-78.25 11114,-71.25 11138.1,-63.46 11163.82,-51.85 11184.62,-41.55\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11186.01,-44.78 11193.36,-37.15 11182.86,-38.52 11186.01,-44.78\"/>\n", + "<text text-anchor=\"middle\" x=\"11159.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b125 -->\n", + "<g id=\"node126\" class=\"node\">\n", + "<title>b125</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10592.25,-36 10367.75,-36 10367.75,0 10592.25,0 10592.25,-36\"/>\n", + "<text text-anchor=\"start\" x=\"10375.75\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">BBPrepare[PrepareIdentity]ā </text>\n", + "<text text-anchor=\"start\" x=\"10420\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=BlackBox ...</text>\n", + "</g>\n", + "<!-- b22->b125 -->\n", + "<g id=\"edge57\" class=\"edge\">\n", + "<title>b22->b125</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10808.87,-88.77C10775.37,-83.62 10739.23,-77.63 10706,-71.25 10704.18,-70.9 10629.53,-53.63 10566.52,-39.04\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10567.33,-35.64 10556.79,-36.79 10565.75,-42.45 10567.33,-35.64\"/>\n", + "<text text-anchor=\"middle\" x=\"10710.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b127 -->\n", + "<g id=\"node128\" class=\"node\">\n", + "<title>b127</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10827.88,-36 10610.12,-36 10610.12,0 10827.88,0 10827.88,-36\"/>\n", + "<text text-anchor=\"start\" x=\"10618.12\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">BBPrepare[PrepareIdentity]</text>\n", + "<text text-anchor=\"start\" x=\"10659\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">prepare=PrepareI ...</text>\n", + "</g>\n", + "<!-- b22->b127 -->\n", + "<g id=\"edge59\" class=\"edge\">\n", + "<title>b22->b127</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10768.75,-88.86C10750.84,-84.28 10736.41,-78.52 10729,-71.25 10722.74,-65.12 10719.75,-56.35 10718.46,-47.75\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10721.96,-47.6 10717.73,-37.89 10714.98,-48.12 10721.96,-47.6\"/>\n", + "<text text-anchor=\"middle\" x=\"10733.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b128 -->\n", + "<g id=\"node129\" class=\"node\">\n", + "<title>b128</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11078,-36 10846,-36 10846,0 11078,0 11078,-36\"/>\n", + "<text text-anchor=\"start\" x=\"10937.62\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">C[58]Z</text>\n", + "<text text-anchor=\"start\" x=\"10854\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">cvs=(0, 0, 0 ..., target_gate=cirq.Z</text>\n", + "</g>\n", + "<!-- b22->b128 -->\n", + "<g id=\"edge60\" class=\"edge\">\n", + "<title>b22->b128</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10933.1,-88.84C10933.1,-78.45 10934.07,-65.15 10938,-54 10938.96,-51.26 10940.2,-48.54 10941.6,-45.89\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10944.53,-47.81 10946.8,-37.46 10938.57,-44.14 10944.53,-47.81\"/>\n", + "<text text-anchor=\"middle\" x=\"10942.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b23->b49 -->\n", + "<g id=\"edge144\" class=\"edge\">\n", + "<title>b23->b49</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10492,-178.26C10492,-166.43 10492,-150.45 10492,-136.75\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10495.5,-136.97 10492,-126.97 10488.5,-136.97 10495.5,-136.97\"/>\n", + "<text text-anchor=\"middle\" x=\"10496.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b50 -->\n", + "<g id=\"node51\" class=\"node\">\n", + "<title>b50</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10262,-125.25 9982,-125.25 9982,-89.25 10262,-89.25 10262,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"10095\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">C[B[H]]</text>\n", + "<text text-anchor=\"start\" x=\"9990\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">subbloq=KikuchiH ..., ctrl_spec=CtrlSpec ...</text>\n", + "</g>\n", + "<!-- b23->b50 -->\n", + "<g id=\"edge145\" class=\"edge\">\n", + "<title>b23->b50</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10351.78,-179.43C10320.96,-174.52 10288.67,-168.29 10259,-160.5 10229.27,-152.7 10197.11,-140.63 10171.42,-130.06\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10172.8,-126.84 10162.23,-126.22 10170.11,-133.3 10172.8,-126.84\"/>\n", + "<text text-anchor=\"middle\" x=\"10263.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b24->b51 -->\n", + "<g id=\"edge148\" class=\"edge\">\n", + "<title>b24->b51</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1659.21,-178.05C1637.99,-164.74 1608.55,-146.26 1585.29,-131.66\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1587.36,-128.82 1577.03,-126.47 1583.64,-134.75 1587.36,-128.82\"/>\n", + "<text text-anchor=\"middle\" x=\"1634.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b24->b52 -->\n", + "<g id=\"edge149\" class=\"edge\">\n", + "<title>b24->b52</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1501.78,-178.21C1444.82,-172.12 1393.67,-165.54 1381,-160.5 1369.13,-155.78 1369.94,-147.8 1358,-143.25 1316.58,-127.47 1207.82,-129.77 1148.5,-125.32\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1149.11,-121.86 1138.84,-124.46 1148.49,-128.83 1149.11,-121.86\"/>\n", + "<text text-anchor=\"middle\" x=\"1385.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b24->b53 -->\n", + "<g id=\"edge150\" class=\"edge\">\n", + "<title>b24->b53</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1537.12,-178.04C1506.46,-173.29 1474.54,-167.48 1445,-160.5 1421.3,-154.9 1416.19,-150.69 1393,-143.25 1378.44,-138.58 1362.8,-133.67 1347.93,-129.05\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1349.3,-125.81 1338.71,-126.19 1347.23,-132.5 1349.3,-125.81\"/>\n", + "<text text-anchor=\"middle\" x=\"1449.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b24->b54 -->\n", + "<g id=\"edge151\" class=\"edge\">\n", + "<title>b24->b54</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1713.39,-178.05C1733.45,-164.8 1761.25,-146.42 1783.29,-131.86\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1784.98,-134.93 1791.39,-126.5 1781.12,-129.1 1784.98,-134.93\"/>\n", + "<text text-anchor=\"middle\" x=\"1769.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b55 -->\n", + "<g id=\"node56\" class=\"node\">\n", + "<title>b55</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"12627,-125.25 12467,-125.25 12467,-89.25 12627,-89.25 12627,-125.25\"/>\n", + "<text text-anchor=\"start\" x=\"12499.75\" y=\"-106.95\" font-family=\"Times,serif\" font-size=\"14.00\">GuidingState</text>\n", + "<text text-anchor=\"start\" x=\"12475\" y=\"-96.75\" font-family=\"monospace\" font-size=\"10.00\">inst=KXorInst ..., ell=8</text>\n", + "</g>\n", + "<!-- b24->b55 -->\n", + "<g id=\"edge152\" class=\"edge\">\n", + "<title>b24->b55</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1872.46,-194.77C3055.88,-190.09 9502.3,-164.43 9514,-160.5 9526.11,-156.43 9524.89,-147.33 9537,-143.25 9606.07,-119.96 12088.13,-127.1 12161,-125.25 12261.82,-122.68 12377.37,-117.27 12455.56,-113.24\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12455.5,-116.74 12465.31,-112.73 12455.14,-109.75 12455.5,-116.74\"/>\n", + "<text text-anchor=\"middle\" x=\"9541.5\" y=\"-147.2\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b129 -->\n", + "<g id=\"node130\" class=\"node\">\n", + "<title>b129</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10070,-36 9676,-36 9676,0 10070,0 10070,-36\"/>\n", + "<text text-anchor=\"start\" x=\"9777.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">B[SparseMatrixHermitian]</text>\n", + "<text text-anchor=\"start\" x=\"9684\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">col_oracle=BlackBox ..., entry_oracle=BlackBox ..., eps=0, cv=1</text>\n", + "</g>\n", + "<!-- b25->b129 -->\n", + "<g id=\"edge19\" class=\"edge\">\n", + "<title>b25->b129</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9833.68,-89.01C9840.59,-76.7 9850.03,-59.91 9857.92,-45.85\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9860.75,-47.95 9862.6,-37.52 9854.65,-44.53 9860.75,-47.95\"/>\n", + "<text text-anchor=\"middle\" x=\"9856.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b56 -->\n", + "<g id=\"node57\" class=\"node\">\n", + "<title>b56</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1122,-36 860,-36 860,0 1122,0 1122,-36\"/>\n", + "<text text-anchor=\"start\" x=\"949.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"868\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.5, global_shift=0.0, eps=1e-10</text>\n", + "</g>\n", + "<!-- b26->b56 -->\n", + "<g id=\"edge28\" class=\"edge\">\n", + "<title>b26->b56</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M1964.95,-89.82C1961.95,-89.62 1958.96,-89.43 1956,-89.25 1650.23,-70.76 1571.59,-103.85 1267,-71.25 1202.58,-64.36 1130.7,-50.55 1076.44,-38.86\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1077.48,-35.5 1066.96,-36.79 1075.99,-42.34 1077.48,-35.5\"/>\n", + "<text text-anchor=\"middle\" x=\"1271.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b57 -->\n", + "<g id=\"node58\" class=\"node\">\n", + "<title>b57</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2792,-36 2482,-36 2482,0 2792,0 2792,-36\"/>\n", + "<text text-anchor=\"start\" x=\"2595.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"2490\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.25, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b27->b57 -->\n", + "<g id=\"edge29\" class=\"edge\">\n", + "<title>b27->b57</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2521.79,-88.8C2543.87,-75.43 2574.54,-56.84 2598.69,-42.21\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"2600.22,-45.38 2606.96,-37.2 2596.59,-39.39 2600.22,-45.38\"/>\n", + "<text text-anchor=\"middle\" x=\"2582.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b58 -->\n", + "<g id=\"node59\" class=\"node\">\n", + "<title>b58</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1456,-36 1140,-36 1140,0 1456,0 1456,-36\"/>\n", + "<text text-anchor=\"start\" x=\"1256.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"1148\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.125, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b27->b58 -->\n", + "<g id=\"edge30\" class=\"edge\">\n", + "<title>b27->b58</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2322.95,-89.93C2319.94,-89.69 2316.96,-89.47 2314,-89.25 2163.53,-78.12 2125.6,-80.45 1975,-71.25 1751.87,-57.62 1693.26,-55.41 1467.44,-36.19\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1467.98,-32.73 1457.72,-35.37 1467.39,-39.7 1467.98,-32.73\"/>\n", + "<text text-anchor=\"middle\" x=\"1979.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b59 -->\n", + "<g id=\"node60\" class=\"node\">\n", + "<title>b59</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"1796,-36 1474,-36 1474,0 1796,0 1796,-36\"/>\n", + "<text text-anchor=\"start\" x=\"1593.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"1482\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.0625, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b27->b59 -->\n", + "<g id=\"edge31\" class=\"edge\">\n", + "<title>b27->b59</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2322.72,-88.93C2173.39,-73.75 1957.32,-51.78 1807.37,-36.53\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"1808.05,-33.08 1797.75,-35.55 1807.34,-40.04 1808.05,-33.08\"/>\n", + "<text text-anchor=\"middle\" x=\"2145.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b60 -->\n", + "<g id=\"node61\" class=\"node\">\n", + "<title>b60</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2118,-36 1814,-36 1814,0 2118,0 2118,-36\"/>\n", + "<text text-anchor=\"start\" x=\"1924.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"1822\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.5, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b27->b60 -->\n", + "<g id=\"edge32\" class=\"edge\">\n", + "<title>b27->b60</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2387.3,-88.75C2299.18,-74.16 2173.79,-53.4 2082.73,-38.33\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"2083.45,-34.9 2073.01,-36.72 2082.31,-41.8 2083.45,-34.9\"/>\n", + "<text text-anchor=\"middle\" x=\"2281.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b61 -->\n", + "<g id=\"node62\" class=\"node\">\n", + "<title>b61</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"2464,-36 2136,-36 2136,0 2464,0 2464,-36\"/>\n", + "<text text-anchor=\"start\" x=\"2258.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"2144\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.03125, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b27->b61 -->\n", + "<g id=\"edge33\" class=\"edge\">\n", + "<title>b27->b61</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M2454.41,-88.8C2424.03,-75.07 2381.51,-55.85 2348.78,-41.05\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"2350.46,-37.97 2339.9,-37.04 2347.58,-44.35 2350.46,-37.97\"/>\n", + "<text text-anchor=\"middle\" x=\"2418.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b62 -->\n", + "<g id=\"node63\" class=\"node\">\n", + "<title>b62</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"4814,-36 4510,-36 4510,0 4814,0 4814,-36\"/>\n", + "<text text-anchor=\"start\" x=\"4620.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"4518\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.5, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b28->b62 -->\n", + "<g id=\"edge34\" class=\"edge\">\n", + "<title>b28->b62</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M4135.17,-88.75C4246.26,-74.04 4404.72,-53.06 4518.8,-37.96\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"4519.1,-41.45 4528.55,-36.67 4518.18,-34.51 4519.1,-41.45\"/>\n", + "<text text-anchor=\"middle\" x=\"4396.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b63 -->\n", + "<g id=\"node64\" class=\"node\">\n", + "<title>b63</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3126,-36 2810,-36 2810,0 3126,0 3126,-36\"/>\n", + "<text text-anchor=\"start\" x=\"2926.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"2818\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.125, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b28->b63 -->\n", + "<g id=\"edge35\" class=\"edge\">\n", + "<title>b28->b63</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M3832.85,-93.53C3660.44,-80.39 3385.68,-58.79 3137.63,-36.23\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"3138,-32.75 3127.72,-35.33 3137.36,-39.72 3138,-32.75\"/>\n", + "<text text-anchor=\"middle\" x=\"3544.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b64 -->\n", + "<g id=\"node65\" class=\"node\">\n", + "<title>b64</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3472,-36 3144,-36 3144,0 3472,0 3472,-36\"/>\n", + "<text text-anchor=\"start\" x=\"3266.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"3152\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.03125, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b28->b64 -->\n", + "<g id=\"edge36\" class=\"edge\">\n", + "<title>b28->b64</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M3863.61,-88.75C3746.22,-74.01 3578.66,-52.98 3458.29,-37.87\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"3459.02,-34.43 3448.66,-36.66 3458.15,-41.38 3459.02,-34.43\"/>\n", + "<text text-anchor=\"middle\" x=\"3722.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b65 -->\n", + "<g id=\"node66\" class=\"node\">\n", + "<title>b65</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"3824,-36 3490,-36 3490,0 3824,0 3824,-36\"/>\n", + "<text text-anchor=\"start\" x=\"3615.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"3498\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.015625, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b28->b65 -->\n", + "<g id=\"edge37\" class=\"edge\">\n", + "<title>b28->b65</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M3933.81,-88.8C3877.1,-74.5 3796.75,-54.24 3737.23,-39.23\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"3738.38,-35.91 3727.83,-36.86 3736.67,-42.7 3738.38,-35.91\"/>\n", + "<text text-anchor=\"middle\" x=\"3865.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b66 -->\n", + "<g id=\"node67\" class=\"node\">\n", + "<title>b66</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"4164,-36 3842,-36 3842,0 4164,0 4164,-36\"/>\n", + "<text text-anchor=\"start\" x=\"3961.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"3850\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.0625, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b28->b66 -->\n", + "<g id=\"edge38\" class=\"edge\">\n", + "<title>b28->b66</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M4003,-89.01C4003,-77.18 4003,-61.2 4003,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"4006.5,-47.72 4003,-37.72 3999.5,-47.72 4006.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"4007.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b67 -->\n", + "<g id=\"node68\" class=\"node\">\n", + "<title>b67</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"4492,-36 4182,-36 4182,0 4492,0 4492,-36\"/>\n", + "<text text-anchor=\"start\" x=\"4295.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"4190\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.25, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b28->b67 -->\n", + "<g id=\"edge39\" class=\"edge\">\n", + "<title>b28->b67</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M4069.79,-88.8C4124.42,-74.53 4201.77,-54.33 4259.2,-39.32\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"4259.79,-42.79 4268.58,-36.87 4258.02,-36.01 4259.79,-42.79\"/>\n", + "<text text-anchor=\"middle\" x=\"4204.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b68 -->\n", + "<g id=\"node69\" class=\"node\">\n", + "<title>b68</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"5404,-36 5124,-36 5124,0 5404,0 5404,-36\"/>\n", + "<text text-anchor=\"start\" x=\"5222.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"5132\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.25, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b29->b68 -->\n", + "<g id=\"edge40\" class=\"edge\">\n", + "<title>b29->b68</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M5507.21,-88.8C5457.79,-74.62 5387.96,-54.58 5335.79,-39.61\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"5336.98,-36.3 5326.4,-36.91 5335.04,-43.03 5336.98,-36.3\"/>\n", + "<text text-anchor=\"middle\" x=\"5448.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b69 -->\n", + "<g id=\"node70\" class=\"node\">\n", + "<title>b69</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"5714,-36 5422,-36 5422,0 5714,0 5714,-36\"/>\n", + "<text text-anchor=\"start\" x=\"5526.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"5430\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.0625, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b29->b69 -->\n", + "<g id=\"edge41\" class=\"edge\">\n", + "<title>b29->b69</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M5568,-89.01C5568,-77.18 5568,-61.2 5568,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"5571.5,-47.72 5568,-37.72 5564.5,-47.72 5571.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"5572.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b70 -->\n", + "<g id=\"node71\" class=\"node\">\n", + "<title>b70</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"6018,-36 5732,-36 5732,0 6018,0 6018,-36\"/>\n", + "<text text-anchor=\"start\" x=\"5833.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"5740\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.125, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b29->b70 -->\n", + "<g id=\"edge42\" class=\"edge\">\n", + "<title>b29->b70</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M5629.39,-88.8C5679.3,-74.62 5749.82,-54.58 5802.5,-39.61\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"5803.34,-43.01 5812,-36.9 5801.42,-36.27 5803.34,-43.01\"/>\n", + "<text text-anchor=\"middle\" x=\"5753.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b71 -->\n", + "<g id=\"node72\" class=\"node\">\n", + "<title>b71</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"5106,-36 4832,-36 4832,0 5106,0 5106,-36\"/>\n", + "<text text-anchor=\"start\" x=\"4927.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"4840\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.5, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b29->b71 -->\n", + "<g id=\"edge43\" class=\"edge\">\n", + "<title>b29->b71</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M5447.86,-88.75C5347.2,-74.09 5203.73,-53.19 5100.1,-38.1\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"5100.83,-34.67 5090.43,-36.69 5099.83,-41.59 5100.83,-34.67\"/>\n", + "<text text-anchor=\"middle\" x=\"5327.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b72 -->\n", + "<g id=\"node73\" class=\"node\">\n", + "<title>b72</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"6584,-36 6316,-36 6316,0 6584,0 6584,-36\"/>\n", + "<text text-anchor=\"start\" x=\"6408.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"6324\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.25, global_shift=0.0, eps=5e-11</text>\n", + "</g>\n", + "<!-- b30->b72 -->\n", + "<g id=\"edge44\" class=\"edge\">\n", + "<title>b30->b72</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6336.39,-88.8C6358.07,-75.49 6388.14,-57.01 6411.9,-42.41\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"6413.68,-45.43 6420.37,-37.21 6410.01,-39.46 6413.68,-45.43\"/>\n", + "<text text-anchor=\"middle\" x=\"6396.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b73 -->\n", + "<g id=\"node74\" class=\"node\">\n", + "<title>b73</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"6298,-36 6036,-36 6036,0 6298,0 6298,-36\"/>\n", + "<text text-anchor=\"start\" x=\"6125.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"6044\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.5, global_shift=0.0, eps=5e-11</text>\n", + "</g>\n", + "<!-- b30->b73 -->\n", + "<g id=\"edge45\" class=\"edge\">\n", + "<title>b30->b73</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6279.81,-88.8C6258.29,-75.49 6228.43,-57.01 6204.83,-42.41\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"6206.78,-39.5 6196.43,-37.21 6203.09,-45.45 6206.78,-39.5\"/>\n", + "<text text-anchor=\"middle\" x=\"6255.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b74 -->\n", + "<g id=\"node75\" class=\"node\">\n", + "<title>b74</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"7568,-36 7264,-36 7264,0 7568,0 7568,-36\"/>\n", + "<text text-anchor=\"start\" x=\"7374.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"7272\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.5, global_shift=0.0, eps=3.333333 ...</text>\n", + "</g>\n", + "<!-- b31->b74 -->\n", + "<g id=\"edge46\" class=\"edge\">\n", + "<title>b31->b74</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M7021.88,-88.75C7104.06,-74.21 7220.9,-53.53 7306.02,-38.46\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"7306.56,-41.92 7315.8,-36.73 7305.34,-35.03 7306.56,-41.92\"/>\n", + "<text text-anchor=\"middle\" x=\"7218.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b75 -->\n", + "<g id=\"node76\" class=\"node\">\n", + "<title>b75</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"6912,-36 6602,-36 6602,0 6912,0 6912,-36\"/>\n", + "<text text-anchor=\"start\" x=\"6715.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"6610\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.25, global_shift=0.0, eps=3.333333 ...</text>\n", + "</g>\n", + "<!-- b31->b75 -->\n", + "<g id=\"edge47\" class=\"edge\">\n", + "<title>b31->b75</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6889.81,-88.8C6864.02,-75.25 6828.06,-56.35 6800.06,-41.63\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"6801.96,-38.68 6791.48,-37.12 6798.7,-44.87 6801.96,-38.68\"/>\n", + "<text text-anchor=\"middle\" x=\"6859.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b76 -->\n", + "<g id=\"node77\" class=\"node\">\n", + "<title>b76</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"7246,-36 6930,-36 6930,0 7246,0 7246,-36\"/>\n", + "<text text-anchor=\"start\" x=\"7046.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"6938\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=0.125, global_shift=0.0, eps=3.333333 ...</text>\n", + "</g>\n", + "<!-- b31->b76 -->\n", + "<g id=\"edge48\" class=\"edge\">\n", + "<title>b31->b76</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M6955.99,-88.8C6981.62,-75.25 7017.37,-56.35 7045.2,-41.63\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"7046.52,-44.89 7053.73,-37.12 7043.25,-38.7 7046.52,-44.89\"/>\n", + "<text text-anchor=\"middle\" x=\"7025.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b123 -->\n", + "<g id=\"node124\" class=\"node\">\n", + "<title>b123</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"12246,-36 11834,-36 11834,0 12246,0 12246,-36\"/>\n", + "<text text-anchor=\"start\" x=\"11944.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">B[SparseMatrixHermitian]</text>\n", + "<text text-anchor=\"start\" x=\"11842\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">col_oracle=BlackBox ..., entry_oracle=BlackBox ..., eps=0, cv=None</text>\n", + "</g>\n", + "<!-- b32->b123 -->\n", + "<g id=\"edge51\" class=\"edge\">\n", + "<title>b32->b123</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11771.19,-88.8C11826.15,-74.53 11903.96,-54.33 11961.73,-39.32\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11962.38,-42.77 11971.18,-36.87 11960.62,-36 11962.38,-42.77\"/>\n", + "<text text-anchor=\"middle\" x=\"11906.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b77 -->\n", + "<g id=\"node78\" class=\"node\">\n", + "<title>b77</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"7778.12,-36 7585.88,-36 7585.88,0 7778.12,0 7778.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"7593.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"7622\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b77 -->\n", + "<g id=\"edge62\" class=\"edge\">\n", + "<title>b33->b77</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8718.43,-103.15C8525.56,-97.03 8131.85,-80.09 7789.76,-36.31\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"7790.24,-32.85 7779.88,-35.04 7789.35,-39.79 7790.24,-32.85\"/>\n", + "<text text-anchor=\"middle\" x=\"8108.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b78 -->\n", + "<g id=\"node79\" class=\"node\">\n", + "<title>b78</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"7988.12,-36 7795.88,-36 7795.88,0 7988.12,0 7988.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"7803.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"7832\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b78 -->\n", + "<g id=\"edge63\" class=\"edge\">\n", + "<title>b33->b78</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8718.39,-99.82C8557.67,-90.33 8261.65,-70.07 7999.65,-36.3\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"8000.25,-32.85 7989.88,-35.03 7999.34,-39.79 8000.25,-32.85\"/>\n", + "<text text-anchor=\"middle\" x=\"8324.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b79 -->\n", + "<g id=\"node80\" class=\"node\">\n", + "<title>b79</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"8198.12,-36 8005.88,-36 8005.88,0 8198.12,0 8198.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"8013.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"8042\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b79 -->\n", + "<g id=\"edge65\" class=\"edge\">\n", + "<title>b33->b79</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8718.33,-94.9C8594.05,-82.59 8392.94,-61.44 8209.6,-36.33\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"8210.27,-32.89 8199.88,-34.99 8209.31,-39.82 8210.27,-32.89\"/>\n", + "<text text-anchor=\"middle\" x=\"8487.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b80 -->\n", + "<g id=\"node81\" class=\"node\">\n", + "<title>b80</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"8408.12,-36 8215.88,-36 8215.88,0 8408.12,0 8408.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"8223.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"8252\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b80 -->\n", + "<g id=\"edge66\" class=\"edge\">\n", + "<title>b33->b80</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8731.71,-88.75C8641.05,-73.68 8510.78,-52.04 8419.49,-36.86\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"8420.21,-33.44 8409.77,-35.25 8419.06,-40.34 8420.21,-33.44\"/>\n", + "<text text-anchor=\"middle\" x=\"8625.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b81 -->\n", + "<g id=\"node82\" class=\"node\">\n", + "<title>b81</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"8618.12,-36 8425.88,-36 8425.88,0 8618.12,0 8618.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"8433.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"8462\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b81 -->\n", + "<g id=\"edge68\" class=\"edge\">\n", + "<title>b33->b81</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8774.01,-88.8C8722.7,-74.59 8650.14,-54.49 8596.05,-39.51\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"8597.18,-36.19 8586.61,-36.9 8595.31,-42.94 8597.18,-36.19\"/>\n", + "<text text-anchor=\"middle\" x=\"8711.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b82 -->\n", + "<g id=\"node83\" class=\"node\">\n", + "<title>b82</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"8828.12,-36 8635.88,-36 8635.88,0 8828.12,0 8828.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"8643.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"8672\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b82 -->\n", + "<g id=\"edge70\" class=\"edge\">\n", + "<title>b33->b82</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8816,-88.8C8800.41,-75.84 8778.93,-58 8761.59,-43.59\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"8764.05,-41.08 8754.12,-37.38 8759.58,-46.47 8764.05,-41.08\"/>\n", + "<text text-anchor=\"middle\" x=\"8797.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b83 -->\n", + "<g id=\"node84\" class=\"node\">\n", + "<title>b83</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9038.12,-36 8845.88,-36 8845.88,0 9038.12,0 9038.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"8853.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"8882\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b83 -->\n", + "<g id=\"edge71\" class=\"edge\">\n", + "<title>b33->b83</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8858,-88.8C8873.59,-75.84 8895.07,-58 8912.41,-43.59\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"8914.42,-46.47 8919.88,-37.38 8909.95,-41.08 8914.42,-46.47\"/>\n", + "<text text-anchor=\"middle\" x=\"8902.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b84 -->\n", + "<g id=\"node85\" class=\"node\">\n", + "<title>b84</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9248.12,-36 9055.88,-36 9055.88,0 9248.12,0 9248.12,-36\"/>\n", + "<text text-anchor=\"start\" x=\"9063.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradientā </text>\n", + "<text text-anchor=\"start\" x=\"9092\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=PRGAViaP ...</text>\n", + "</g>\n", + "<!-- b33->b84 -->\n", + "<g id=\"edge72\" class=\"edge\">\n", + "<title>b33->b84</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8899.99,-88.8C8951.3,-74.59 9023.86,-54.49 9077.95,-39.51\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9078.69,-42.94 9087.39,-36.9 9076.82,-36.19 9078.69,-42.94\"/>\n", + "<text text-anchor=\"middle\" x=\"9026.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b96 -->\n", + "<g id=\"node97\" class=\"node\">\n", + "<title>b96</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"12832,-36 12642,-36 12642,0 12832,0 12832,-36\"/>\n", + "<text text-anchor=\"start\" x=\"12727.62\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">Rx</text>\n", + "<text text-anchor=\"start\" x=\"12650\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">angle=-1.57079 ..., eps=1e-11</text>\n", + "</g>\n", + "<!-- b33->b96 -->\n", + "<g id=\"edge67\" class=\"edge\">\n", + "<title>b33->b96</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8955.49,-97.13C9000.13,-94.06 9051.37,-90.98 9098,-89.25 9152.99,-87.21 11026.87,-88.89 11079,-71.25 11091.1,-67.15 11089.9,-58.11 11102,-54 11180.18,-27.43 12469.34,-42.44 12630.16,-35.83\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12630.29,-39.33 12640.07,-35.26 12629.88,-32.34 12630.29,-39.33\"/>\n", + "<text text-anchor=\"middle\" x=\"11106.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">7</text>\n", + "</g>\n", + "<!-- b97 -->\n", + "<g id=\"node98\" class=\"node\">\n", + "<title>b97</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11816,-36 11626,-36 11626,0 11816,0 11816,-36\"/>\n", + "<text text-anchor=\"start\" x=\"11711.62\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">Rx</text>\n", + "<text text-anchor=\"start\" x=\"11634\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">angle=1.570796 ..., eps=1e-11</text>\n", + "</g>\n", + "<!-- b33->b97 -->\n", + "<g id=\"edge69\" class=\"edge\">\n", + "<title>b33->b97</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8955.49,-97.15C9000.13,-94.09 9051.38,-91 9098,-89.25 9196.82,-85.53 10781,-90.49 10878,-71.25 10898.2,-67.24 10900.83,-58.17 10921,-54 11069.12,-23.41 11445.54,-49.29 11614.28,-36.09\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11614.4,-39.59 11624.06,-35.25 11613.8,-32.62 11614.4,-39.59\"/>\n", + "<text text-anchor=\"middle\" x=\"10925.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">7</text>\n", + "</g>\n", + "<!-- b130 -->\n", + "<g id=\"node131\" class=\"node\">\n", + "<title>b130</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11435.75,-36 11376.25,-36 11376.25,0 11435.75,0 11435.75,-36\"/>\n", + "<text text-anchor=\"start\" x=\"11384.25\" y=\"-13.32\" font-family=\"Times,serif\" font-size=\"14.00\">XGate</text>\n", + "</g>\n", + "<!-- b33->b130 -->\n", + "<g id=\"edge64\" class=\"edge\">\n", + "<title>b33->b130</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M8955.51,-97.67C9000.16,-94.67 9051.4,-91.49 9098,-89.25 9356.49,-76.84 9421.89,-89.95 9680,-71.25 9747.37,-66.37 9763.59,-58.23 9831,-54 9913.68,-48.81 11204.54,-53.61 11364.81,-35.15\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11365.31,-38.61 11374.67,-33.64 11364.25,-31.69 11365.31,-38.61\"/>\n", + "<text text-anchor=\"middle\" x=\"9835.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", + "</g>\n", + "<!-- b85 -->\n", + "<g id=\"node86\" class=\"node\">\n", + "<title>b85</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"136,-36 0,-36 0,0 136,0 136,-36\"/>\n", + "<text text-anchor=\"start\" x=\"49.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CCXā </text>\n", + "<text text-anchor=\"start\" x=\"8\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=MultiCon ...</text>\n", + "</g>\n", + "<!-- b34->b85 -->\n", + "<g id=\"edge79\" class=\"edge\">\n", + "<title>b34->b85</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M476.52,-95.22C399.06,-82.52 268.89,-60.51 147.38,-36.44\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"148.38,-33.07 137.89,-34.55 147.01,-39.93 148.38,-33.07\"/>\n", + "<text text-anchor=\"middle\" x=\"335.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b86 -->\n", + "<g id=\"node87\" class=\"node\">\n", + "<title>b86</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"290,-36 154,-36 154,0 290,0 290,-36\"/>\n", + "<text text-anchor=\"start\" x=\"166.88\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">HasDuplicatesā </text>\n", + "<text text-anchor=\"start\" x=\"162\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=HasDupli ...</text>\n", + "</g>\n", + "<!-- b34->b86 -->\n", + "<g id=\"edge81\" class=\"edge\">\n", + "<title>b34->b86</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M480.41,-88.8C427.68,-74.56 353.09,-54.41 297.59,-39.42\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"298.78,-36.11 288.21,-36.89 296.95,-42.87 298.78,-36.11\"/>\n", + "<text text-anchor=\"middle\" x=\"417.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b87 -->\n", + "<g id=\"node88\" class=\"node\">\n", + "<title>b87</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"444,-36 308,-36 308,0 444,0 444,-36\"/>\n", + "<text text-anchor=\"start\" x=\"331\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">SortInPlaceā </text>\n", + "<text text-anchor=\"start\" x=\"316\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=SortInPl ...</text>\n", + "</g>\n", + "<!-- b34->b87 -->\n", + "<g id=\"edge82\" class=\"edge\">\n", + "<title>b34->b87</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M511.21,-88.8C484.95,-75.25 448.34,-56.35 419.84,-41.63\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"421.57,-38.59 411.08,-37.11 418.36,-44.81 421.57,-38.59\"/>\n", + "<text text-anchor=\"middle\" x=\"480.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b88 -->\n", + "<g id=\"node89\" class=\"node\">\n", + "<title>b88</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"628.38,-36 461.62,-36 461.62,0 628.38,0 628.38,-36\"/>\n", + "<text text-anchor=\"start\" x=\"469.62\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">SimpleGuidingStateā </text>\n", + "<text text-anchor=\"start\" x=\"485\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=SimpleGu ...</text>\n", + "</g>\n", + "<!-- b34->b88 -->\n", + "<g id=\"edge83\" class=\"edge\">\n", + "<title>b34->b88</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M545,-89.01C545,-77.18 545,-61.2 545,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"548.5,-47.72 545,-37.72 541.5,-47.72 548.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"549.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", + "</g>\n", + "<!-- b89 -->\n", + "<g id=\"node90\" class=\"node\">\n", + "<title>b89</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"841.62,-36 646.38,-36 646.38,0 841.62,0 841.62,-36\"/>\n", + "<text text-anchor=\"start\" x=\"654.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">ProbabilisticUncomputeā </text>\n", + "<text text-anchor=\"start\" x=\"684\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">subbloq=Probabil ...</text>\n", + "</g>\n", + "<!-- b34->b89 -->\n", + "<g id=\"edge84\" class=\"edge\">\n", + "<title>b34->b89</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M584.79,-88.8C616.25,-75.01 660.33,-55.68 694.14,-40.86\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"695.14,-44.25 702.89,-37.02 692.33,-37.83 695.14,-44.25\"/>\n", + "<text text-anchor=\"middle\" x=\"667.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b34->b130 -->\n", + "<g id=\"edge80\" class=\"edge\">\n", + "<title>b34->b130</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M613.23,-101.71C679.35,-97.54 782.5,-91.67 872,-89.25 1114.27,-82.71 9356.39,-100.31 9597,-71.25 9629.24,-67.36 9635.78,-58.03 9668,-54 9852.04,-30.97 11136.09,-73.95 11364.91,-35.56\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11365.51,-39.01 11374.68,-33.7 11364.2,-32.13 11365.51,-39.01\"/>\n", + "<text text-anchor=\"middle\" x=\"9672.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b90 -->\n", + "<g id=\"node91\" class=\"node\">\n", + "<title>b90</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9456,-36 9266,-36 9266,0 9456,0 9456,-36\"/>\n", + "<text text-anchor=\"start\" x=\"9347.12\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">And</text>\n", + "<text text-anchor=\"start\" x=\"9274\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">cv1=1, cv2=1, uncompute=False</text>\n", + "</g>\n", + "<!-- b35->b90 -->\n", + "<g id=\"edge90\" class=\"edge\">\n", + "<title>b35->b90</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9312.05,-89.01C9320.74,-76.58 9332.63,-59.58 9342.51,-45.44\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9345.24,-47.64 9348.11,-37.44 9339.51,-43.63 9345.24,-47.64\"/>\n", + "<text text-anchor=\"middle\" x=\"9348.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">147</text>\n", + "</g>\n", + "<!-- b91 -->\n", + "<g id=\"node92\" class=\"node\">\n", + "<title>b91</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"9658,-36 9474,-36 9474,0 9658,0 9658,-36\"/>\n", + "<text text-anchor=\"start\" x=\"9548.75\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">Andā </text>\n", + "<text text-anchor=\"start\" x=\"9482\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">cv1=1, cv2=1, uncompute=True</text>\n", + "</g>\n", + "<!-- b36->b91 -->\n", + "<g id=\"edge92\" class=\"edge\">\n", + "<title>b36->b91</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M9566,-89.01C9566,-77.18 9566,-61.2 9566,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9569.5,-47.72 9566,-37.72 9562.5,-47.72 9569.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"9579.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">147</text>\n", + "</g>\n", + "<!-- b92 -->\n", + "<g id=\"node93\" class=\"node\">\n", + "<title>b92</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"14000,-36 13504,-36 13504,0 14000,0 14000,-36\"/>\n", + "<text text-anchor=\"start\" x=\"13667.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"13512\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=3, phase_bitsize=7, rom_values=(64, 64, ..., control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b92 -->\n", + "<g id=\"edge101\" class=\"edge\">\n", + "<title>b37->b92</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14368.37,-88.75C14237.74,-73.97 14051.13,-52.85 13917.52,-37.73\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"13918.21,-34.29 13907.88,-36.64 13917.42,-41.24 13918.21,-34.29\"/>\n", + "<text text-anchor=\"middle\" x=\"14210.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b93 -->\n", + "<g id=\"node94\" class=\"node\">\n", + "<title>b93</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"14514,-36 14018,-36 14018,0 14514,0 14514,-36\"/>\n", + "<text text-anchor=\"start\" x=\"14181.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"14026\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=4, phase_bitsize=7, rom_values=(64, 64, ..., control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b93 -->\n", + "<g id=\"edge102\" class=\"edge\">\n", + "<title>b37->b93</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14471.61,-88.8C14430.29,-74.77 14372.08,-55.02 14328.15,-40.1\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"14329.33,-36.8 14318.73,-36.9 14327.08,-43.43 14329.33,-36.8\"/>\n", + "<text text-anchor=\"middle\" x=\"14421.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b94 -->\n", + "<g id=\"node95\" class=\"node\">\n", + "<title>b94</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"15028,-36 14532,-36 14532,0 15028,0 15028,-36\"/>\n", + "<text text-anchor=\"start\" x=\"14695.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"14540\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=7, phase_bitsize=7, rom_values=(48, 48, ..., control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b94 -->\n", + "<g id=\"edge104\" class=\"edge\">\n", + "<title>b37->b94</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14574.39,-88.8C14615.71,-74.77 14673.92,-55.02 14717.85,-40.1\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"14718.92,-43.43 14727.27,-36.9 14716.67,-36.8 14718.92,-43.43\"/>\n", + "<text text-anchor=\"middle\" x=\"14678.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b95 -->\n", + "<g id=\"node96\" class=\"node\">\n", + "<title>b95</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"15542,-36 15046,-36 15046,0 15542,0 15542,-36\"/>\n", + "<text text-anchor=\"start\" x=\"15209.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"15054\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=6, phase_bitsize=7, rom_values=(64, 63, ..., control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b95 -->\n", + "<g id=\"edge105\" class=\"edge\">\n", + "<title>b37->b95</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14677.63,-88.75C14808.26,-73.97 14994.87,-52.85 15128.48,-37.73\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"15128.58,-41.24 15138.12,-36.64 15127.79,-34.29 15128.58,-41.24\"/>\n", + "<text text-anchor=\"middle\" x=\"14981.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b37->b96 -->\n", + "<g id=\"edge106\" class=\"edge\">\n", + "<title>b37->b96</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14262.66,-103.5C14005.62,-99.73 13601.46,-91.03 13252,-71.25 13072.62,-61.1 13024.83,-58.73 12843.72,-36.29\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12844.31,-32.84 12833.95,-35.08 12843.45,-39.79 12844.31,-32.84\"/>\n", + "<text text-anchor=\"middle\" x=\"13256.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">7</text>\n", + "</g>\n", + "<!-- b37->b97 -->\n", + "<g id=\"edge107\" class=\"edge\">\n", + "<title>b37->b97</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14262.91,-106.23C13802.47,-105.42 12861.58,-100.15 12534,-71.25 12485.58,-66.98 12474.39,-58.57 12426,-54 12163.59,-29.22 12092.92,-60.73 11827.58,-36.16\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11828.22,-32.7 11817.94,-35.24 11827.56,-39.67 11828.22,-32.7\"/>\n", + "<text text-anchor=\"middle\" x=\"12538.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">7</text>\n", + "</g>\n", + "<!-- b98 -->\n", + "<g id=\"node99\" class=\"node\">\n", + "<title>b98</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"16056,-36 15560,-36 15560,0 16056,0 16056,-36\"/>\n", + "<text text-anchor=\"start\" x=\"15723.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"15568\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=2, phase_bitsize=7, rom_values=(64, 62, ..., control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b98 -->\n", + "<g id=\"edge108\" class=\"edge\">\n", + "<title>b37->b98</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14780.72,-88.75C15003.8,-73.6 15324.86,-51.8 15548.47,-36.62\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"15548.46,-40.13 15558.2,-35.96 15547.99,-33.15 15548.46,-40.13\"/>\n", + "<text text-anchor=\"middle\" x=\"15284.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b99 -->\n", + "<g id=\"node100\" class=\"node\">\n", + "<title>b99</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"16540,-36 16074,-36 16074,0 16540,0 16540,-36\"/>\n", + "<text text-anchor=\"start\" x=\"16222.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"16082\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=1, phase_bitsize=7, rom_values=(64, 0), control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b99 -->\n", + "<g id=\"edge109\" class=\"edge\">\n", + "<title>b37->b99</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14783.32,-96.35C15087.42,-84.34 15606,-62.46 16062.13,-36.16\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"16062.27,-39.66 16072.06,-35.58 16061.87,-32.67 16062.27,-39.66\"/>\n", + "<text text-anchor=\"middle\" x=\"15731.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b100 -->\n", + "<g id=\"node101\" class=\"node\">\n", + "<title>b100</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"17054,-36 16558,-36 16558,0 17054,0 17054,-36\"/>\n", + "<text text-anchor=\"start\" x=\"16721.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"16566\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=5, phase_bitsize=7, rom_values=(64, 64, ..., control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b100 -->\n", + "<g id=\"edge110\" class=\"edge\">\n", + "<title>b37->b100</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14783.4,-100.57C15166.95,-91.46 15906.62,-71 16546.46,-36.13\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"16546.45,-39.64 16556.25,-35.6 16546.07,-32.65 16546.45,-39.64\"/>\n", + "<text text-anchor=\"middle\" x=\"16165.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b101 -->\n", + "<g id=\"node102\" class=\"node\">\n", + "<title>b101</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"17526,-36 17072,-36 17072,0 17526,0 17526,-36\"/>\n", + "<text text-anchor=\"start\" x=\"17214.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">PRGAViaPhaseGradient</text>\n", + "<text text-anchor=\"start\" x=\"17080\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">selection_bitsize=0, phase_bitsize=7, rom_values=(33,), control_bitsize=1</text>\n", + "</g>\n", + "<!-- b37->b101 -->\n", + "<g id=\"edge111\" class=\"edge\">\n", + "<title>b37->b101</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14783.27,-103.88C15241.38,-98.63 16221.91,-82.6 17060.27,-36.14\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"17060.37,-39.64 17070.16,-35.59 17059.98,-32.65 17060.37,-39.64\"/>\n", + "<text text-anchor=\"middle\" x=\"16651.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b37->b130 -->\n", + "<g id=\"edge103\" class=\"edge\">\n", + "<title>b37->b130</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M14262.55,-106.2C13717.54,-105.51 12499.85,-100.66 12414,-71.25 12401.91,-67.11 12403.08,-58.16 12391,-54 12294.4,-20.78 11589.33,-56.3 11446.84,-35.37\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11447.79,-31.98 11437.33,-33.66 11446.55,-38.87 11447.79,-31.98\"/>\n", + "<text text-anchor=\"middle\" x=\"12418.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", + "</g>\n", + "<!-- b102 -->\n", + "<g id=\"node103\" class=\"node\">\n", + "<title>b102</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"18128,-36 17842,-36 17842,0 18128,0 18128,-36\"/>\n", + "<text text-anchor=\"start\" x=\"17943.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"17850\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.25, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b39->b102 -->\n", + "<g id=\"edge120\" class=\"edge\">\n", + "<title>b39->b102</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M18230.61,-88.8C18180.7,-74.62 18110.18,-54.58 18057.5,-39.61\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"18058.58,-36.27 18048,-36.9 18056.66,-43.01 18058.58,-36.27\"/>\n", + "<text text-anchor=\"middle\" x=\"18169.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b103 -->\n", + "<g id=\"node104\" class=\"node\">\n", + "<title>b103</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"18438,-36 18146,-36 18146,0 18438,0 18438,-36\"/>\n", + "<text text-anchor=\"start\" x=\"18250.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"18154\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.125, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b39->b103 -->\n", + "<g id=\"edge121\" class=\"edge\">\n", + "<title>b39->b103</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M18292,-89.01C18292,-77.18 18292,-61.2 18292,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"18295.5,-47.72 18292,-37.72 18288.5,-47.72 18295.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"18296.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b104 -->\n", + "<g id=\"node105\" class=\"node\">\n", + "<title>b104</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"18754,-36 18456,-36 18456,0 18754,0 18754,-36\"/>\n", + "<text text-anchor=\"start\" x=\"18563.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"18464\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.0625, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b39->b104 -->\n", + "<g id=\"edge122\" class=\"edge\">\n", + "<title>b39->b104</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M18354.59,-88.8C18405.58,-74.59 18477.67,-54.49 18531.42,-39.51\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"18532.1,-42.95 18540.79,-36.9 18530.22,-36.21 18532.1,-42.95\"/>\n", + "<text text-anchor=\"middle\" x=\"18480.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b105 -->\n", + "<g id=\"node106\" class=\"node\">\n", + "<title>b105</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"17824,-36 17544,-36 17544,0 17824,0 17824,-36\"/>\n", + "<text text-anchor=\"start\" x=\"17642.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"17552\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.5, global_shift=0.0, eps=2.5e-11</text>\n", + "</g>\n", + "<!-- b39->b105 -->\n", + "<g id=\"edge123\" class=\"edge\">\n", + "<title>b39->b105</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M18199.99,-93.05C18098.04,-78.42 17932.76,-54.7 17816.8,-38.06\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"17817.63,-34.64 17807.23,-36.68 17816.63,-41.57 17817.63,-34.64\"/>\n", + "<text text-anchor=\"middle\" x=\"18046.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b106 -->\n", + "<g id=\"node107\" class=\"node\">\n", + "<title>b106</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"19416,-36 19100,-36 19100,0 19416,0 19416,-36\"/>\n", + "<text text-anchor=\"start\" x=\"19216.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"19108\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.25, global_shift=0.0, eps=3.333333 ...</text>\n", + "</g>\n", + "<!-- b40->b106 -->\n", + "<g id=\"edge124\" class=\"edge\">\n", + "<title>b40->b106</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19258,-89.01C19258,-77.18 19258,-61.2 19258,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"19261.5,-47.72 19258,-37.72 19254.5,-47.72 19261.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"19262.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b107 -->\n", + "<g id=\"node108\" class=\"node\">\n", + "<title>b107</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"19756,-36 19434,-36 19434,0 19756,0 19756,-36\"/>\n", + "<text text-anchor=\"start\" x=\"19553.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"19442\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.125, global_shift=0.0, eps=3.333333 ...</text>\n", + "</g>\n", + "<!-- b40->b107 -->\n", + "<g id=\"edge125\" class=\"edge\">\n", + "<title>b40->b107</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19325.39,-88.8C19380.51,-74.53 19458.56,-54.33 19516.5,-39.32\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"19517.17,-42.77 19525.98,-36.87 19515.42,-35.99 19517.17,-42.77\"/>\n", + "<text text-anchor=\"middle\" x=\"19460.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b108 -->\n", + "<g id=\"node109\" class=\"node\">\n", + "<title>b108</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"19082,-36 18772,-36 18772,0 19082,0 19082,-36\"/>\n", + "<text text-anchor=\"start\" x=\"18885.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"18780\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.5, global_shift=0.0, eps=3.333333 ...</text>\n", + "</g>\n", + "<!-- b40->b108 -->\n", + "<g id=\"edge126\" class=\"edge\">\n", + "<title>b40->b108</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M19191.81,-88.8C19137.78,-74.56 19061.33,-54.41 19004.46,-39.42\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"19005.38,-36.04 18994.82,-36.88 19003.6,-42.81 19005.38,-36.04\"/>\n", + "<text text-anchor=\"middle\" x=\"19126.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b109 -->\n", + "<g id=\"node110\" class=\"node\">\n", + "<title>b109</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"20096,-36 19774,-36 19774,0 20096,0 20096,-36\"/>\n", + "<text text-anchor=\"start\" x=\"19893.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"19782\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.125, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b41->b109 -->\n", + "<g id=\"edge127\" class=\"edge\">\n", + "<title>b41->b109</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M20355.99,-90.6C20269.96,-75.97 20141.23,-54.07 20048.78,-38.35\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"20049.63,-34.95 20039.18,-36.72 20048.46,-41.85 20049.63,-34.95\"/>\n", + "<text text-anchor=\"middle\" x=\"20241.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b110 -->\n", + "<g id=\"node111\" class=\"node\">\n", + "<title>b110</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"20442,-36 20114,-36 20114,0 20442,0 20442,-36\"/>\n", + "<text text-anchor=\"start\" x=\"20236.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"20122\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.0625, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b41->b110 -->\n", + "<g id=\"edge128\" class=\"edge\">\n", + "<title>b41->b110</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M20414.01,-88.8C20387.6,-75.25 20350.77,-56.35 20322.1,-41.63\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"20323.78,-38.56 20313.28,-37.11 20320.58,-44.79 20323.78,-38.56\"/>\n", + "<text text-anchor=\"middle\" x=\"20382.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b111 -->\n", + "<g id=\"node112\" class=\"node\">\n", + "<title>b111</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"20776,-36 20460,-36 20460,0 20776,0 20776,-36\"/>\n", + "<text text-anchor=\"start\" x=\"20576.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"20468\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.25, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b41->b111 -->\n", + "<g id=\"edge129\" class=\"edge\">\n", + "<title>b41->b111</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M20481.99,-88.8C20508.4,-75.25 20545.23,-56.35 20573.9,-41.63\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"20575.42,-44.79 20582.72,-37.11 20572.22,-38.56 20575.42,-44.79\"/>\n", + "<text text-anchor=\"middle\" x=\"20552.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b112 -->\n", + "<g id=\"node113\" class=\"node\">\n", + "<title>b112</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"21104,-36 20794,-36 20794,0 21104,0 21104,-36\"/>\n", + "<text text-anchor=\"start\" x=\"20907.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"20802\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.5, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b41->b112 -->\n", + "<g id=\"edge130\" class=\"edge\">\n", + "<title>b41->b112</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M20539.89,-90.25C20623.74,-75.65 20747.85,-54.03 20837.37,-38.44\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"20837.92,-41.9 20847.17,-36.73 20836.72,-35 20837.92,-41.9\"/>\n", + "<text text-anchor=\"middle\" x=\"20747.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b113 -->\n", + "<g id=\"node114\" class=\"node\">\n", + "<title>b113</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"21456,-36 21122,-36 21122,0 21456,0 21456,-36\"/>\n", + "<text text-anchor=\"start\" x=\"21247.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"21130\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.03125, global_shift=0.0, eps=2.000000 ...</text>\n", + "</g>\n", + "<!-- b41->b113 -->\n", + "<g id=\"edge131\" class=\"edge\">\n", + "<title>b41->b113</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M20540,-96.7C20676.59,-82.53 20935.62,-55.66 21110.31,-37.54\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"21110.6,-41.03 21120.19,-36.51 21109.88,-34.06 21110.6,-41.03\"/>\n", + "<text text-anchor=\"middle\" x=\"20947.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b114 -->\n", + "<g id=\"node115\" class=\"node\">\n", + "<title>b114</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"21742,-36 21474,-36 21474,0 21742,0 21742,-36\"/>\n", + "<text text-anchor=\"start\" x=\"21566.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"21482\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.5, global_shift=0.0, eps=1e-10</text>\n", + "</g>\n", + "<!-- b42->b114 -->\n", + "<g id=\"edge132\" class=\"edge\">\n", + "<title>b42->b114</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M21283.98,-88.8C21350.92,-74.38 21445.98,-53.9 21515.82,-38.86\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"21516.29,-42.34 21525.33,-36.81 21514.82,-35.49 21516.29,-42.34\"/>\n", + "<text text-anchor=\"middle\" x=\"21445.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b115 -->\n", + "<g id=\"node116\" class=\"node\">\n", + "<title>b115</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"22320,-36 22046,-36 22046,0 22320,0 22320,-36\"/>\n", + "<text text-anchor=\"start\" x=\"22141.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"22054\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.25, global_shift=0.0, eps=5e-11</text>\n", + "</g>\n", + "<!-- b43->b115 -->\n", + "<g id=\"edge133\" class=\"edge\">\n", + "<title>b43->b115</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M21951.79,-88.8C21998.65,-74.66 22064.82,-54.68 22114.37,-39.72\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"22115.3,-43.09 22123.86,-36.85 22113.28,-36.39 22115.3,-43.09\"/>\n", + "<text text-anchor=\"middle\" x=\"22068.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b116 -->\n", + "<g id=\"node117\" class=\"node\">\n", + "<title>b116</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"22028,-36 21760,-36 21760,0 22028,0 22028,-36\"/>\n", + "<text text-anchor=\"start\" x=\"21852.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"21768\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.5, global_shift=0.0, eps=5e-11</text>\n", + "</g>\n", + "<!-- b43->b116 -->\n", + "<g id=\"edge134\" class=\"edge\">\n", + "<title>b43->b116</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M21894,-89.01C21894,-77.18 21894,-61.2 21894,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"21897.5,-47.72 21894,-37.72 21890.5,-47.72 21897.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"21898.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b117 -->\n", + "<g id=\"node118\" class=\"node\">\n", + "<title>b117</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"23006,-36 22666,-36 22666,0 23006,0 23006,-36\"/>\n", + "<text text-anchor=\"start\" x=\"22794.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"22674\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.015625, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b44->b117 -->\n", + "<g id=\"edge135\" class=\"edge\">\n", + "<title>b44->b117</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M23117.61,-88.8C23059.91,-74.5 22978.18,-54.24 22917.62,-39.23\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"22918.58,-35.86 22908.03,-36.86 22916.9,-42.66 22918.58,-35.86\"/>\n", + "<text text-anchor=\"middle\" x=\"23047.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b118 -->\n", + "<g id=\"node119\" class=\"node\">\n", + "<title>b118</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"23352,-36 23024,-36 23024,0 23352,0 23352,-36\"/>\n", + "<text text-anchor=\"start\" x=\"23146.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"23032\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.0625, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b44->b118 -->\n", + "<g id=\"edge136\" class=\"edge\">\n", + "<title>b44->b118</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M23188,-89.01C23188,-77.18 23188,-61.2 23188,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"23191.5,-47.72 23188,-37.72 23184.5,-47.72 23191.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"23192.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b119 -->\n", + "<g id=\"node120\" class=\"node\">\n", + "<title>b119</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"23692,-36 23370,-36 23370,0 23692,0 23692,-36\"/>\n", + "<text text-anchor=\"start\" x=\"23489.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"23378\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.125, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b44->b119 -->\n", + "<g id=\"edge137\" class=\"edge\">\n", + "<title>b44->b119</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M23256.59,-88.8C23312.7,-74.53 23392.13,-54.33 23451.1,-39.32\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"23451.94,-42.72 23460.77,-36.86 23450.22,-35.94 23451.94,-42.72\"/>\n", + "<text text-anchor=\"middle\" x=\"23394.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b120 -->\n", + "<g id=\"node121\" class=\"node\">\n", + "<title>b120</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"24026,-36 23710,-36 23710,0 24026,0 24026,-36\"/>\n", + "<text text-anchor=\"start\" x=\"23826.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"23718\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.25, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b44->b120 -->\n", + "<g id=\"edge138\" class=\"edge\">\n", + "<title>b44->b120</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M23280.06,-94.44C23393.26,-79.91 23586.8,-55.08 23720.74,-37.89\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"23720.92,-41.4 23730.4,-36.66 23720.03,-34.46 23720.92,-41.4\"/>\n", + "<text text-anchor=\"middle\" x=\"23592.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b121 -->\n", + "<g id=\"node122\" class=\"node\">\n", + "<title>b121</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"24378,-36 24044,-36 24044,0 24378,0 24378,-36\"/>\n", + "<text text-anchor=\"start\" x=\"24169.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"24052\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.03125, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b44->b121 -->\n", + "<g id=\"edge139\" class=\"edge\">\n", + "<title>b44->b121</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M23279.84,-99.04C23433.29,-86.91 23751.82,-61.34 24032.56,-36.21\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"24032.63,-39.72 24042.28,-35.34 24032.01,-32.75 24032.63,-39.72\"/>\n", + "<text text-anchor=\"middle\" x=\"23829.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b122 -->\n", + "<g id=\"node123\" class=\"node\">\n", + "<title>b122</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"22648,-36 22338,-36 22338,0 22648,0 22648,-36\"/>\n", + "<text text-anchor=\"start\" x=\"22451.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"22346\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=-0.5, global_shift=0.0, eps=1.666666 ...</text>\n", + "</g>\n", + "<!-- b44->b122 -->\n", + "<g id=\"edge140\" class=\"edge\">\n", + "<title>b44->b122</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M23096.07,-94.71C22980.68,-80.22 22781.21,-55.18 22643.45,-37.89\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"22644.26,-34.46 22633.9,-36.69 22643.38,-41.41 22644.26,-34.46\"/>\n", + "<text text-anchor=\"middle\" x=\"22906.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b46->b123 -->\n", + "<g id=\"edge143\" class=\"edge\">\n", + "<title>b46->b123</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12007.9,-89.01C12013.49,-76.82 12021.1,-60.23 12027.5,-46.26\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12030.5,-48.13 12031.48,-37.58 12024.13,-45.21 12030.5,-48.13\"/>\n", + "<text text-anchor=\"middle\" x=\"12027.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b124 -->\n", + "<g id=\"node125\" class=\"node\">\n", + "<title>b124</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"11608,-36 11454,-36 11454,0 11608,0 11608,-36\"/>\n", + "<text text-anchor=\"start\" x=\"11504\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">GPhase</text>\n", + "<text text-anchor=\"start\" x=\"11462\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=1.0, eps=1e-11</text>\n", + "</g>\n", + "<!-- b47->b124 -->\n", + "<g id=\"edge55\" class=\"edge\">\n", + "<title>b47->b124</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11414.19,-88.8C11436.57,-75.43 11467.67,-56.84 11492.15,-42.21\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11493.77,-45.33 11500.56,-37.19 11490.18,-39.32 11493.77,-45.33\"/>\n", + "<text text-anchor=\"middle\" x=\"11475.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b47->b125 -->\n", + "<g id=\"edge53\" class=\"edge\">\n", + "<title>b47->b125</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11163.75,-89.81C11160.81,-89.62 11157.9,-89.43 11155,-89.25 11080.16,-84.49 10888.49,-96.86 10818,-71.25 10805.99,-66.89 10806.92,-58.6 10795,-54 10717.52,-24.13 10689.33,-44.22 10603.97,-36.2\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10604.51,-32.74 10594.2,-35.17 10603.77,-39.7 10604.51,-32.74\"/>\n", + "<text text-anchor=\"middle\" x=\"10822.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b47->b127 -->\n", + "<g id=\"edge56\" class=\"edge\">\n", + "<title>b47->b127</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11163.75,-89.85C11160.81,-89.65 11157.9,-89.45 11155,-89.25 11027.93,-80.56 10992.72,-101.48 10869,-71.25 10850.59,-66.75 10847.73,-60.69 10830,-54 10816.95,-49.07 10802.86,-44.26 10789.25,-39.85\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10790.5,-36.58 10779.91,-36.87 10788.37,-43.25 10790.5,-36.58\"/>\n", + "<text text-anchor=\"middle\" x=\"10873.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b47->b128 -->\n", + "<g id=\"edge52\" class=\"edge\">\n", + "<title>b47->b128</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11179.97,-88.8C11134,-83.65 11092.27,-77.67 11070,-71.25 11046.14,-64.37 11021.08,-52.57 11001.11,-41.92\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11002.95,-38.94 10992.5,-37.21 10999.6,-45.08 11002.95,-38.94\"/>\n", + "<text text-anchor=\"middle\" x=\"11074.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b47->b130 -->\n", + "<g id=\"edge54\" class=\"edge\">\n", + "<title>b47->b130</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M11389.15,-89.01C11392.03,-77.06 11395.92,-60.88 11399.24,-47.08\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11402.57,-48.21 11401.51,-37.67 11395.76,-46.58 11402.57,-48.21\"/>\n", + "<text text-anchor=\"middle\" x=\"11401.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", + "</g>\n", + "<!-- b49->b125 -->\n", + "<g id=\"edge15\" class=\"edge\">\n", + "<title>b49->b125</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10489.63,-89.01C10488,-77.18 10485.8,-61.2 10483.92,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10487.4,-47.13 10482.57,-37.7 10480.47,-48.09 10487.4,-47.13\"/>\n", + "<text text-anchor=\"middle\" x=\"10491.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b126 -->\n", + "<g id=\"node127\" class=\"node\">\n", + "<title>b126</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"10350,-36 10088,-36 10088,0 10350,0 10350,-36\"/>\n", + "<text text-anchor=\"start\" x=\"10182.62\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">ZPowGate</text>\n", + "<text text-anchor=\"start\" x=\"10096\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">exponent=1.0, global_shift=0.0, eps=1e-11</text>\n", + "</g>\n", + "<!-- b49->b126 -->\n", + "<g id=\"edge16\" class=\"edge\">\n", + "<title>b49->b126</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10437.41,-88.8C10393.33,-74.72 10331.16,-54.85 10284.42,-39.91\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10285.53,-36.59 10274.94,-36.88 10283.4,-43.26 10285.53,-36.59\"/>\n", + "<text text-anchor=\"middle\" x=\"10383.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b49->b127 -->\n", + "<g id=\"edge17\" class=\"edge\">\n", + "<title>b49->b127</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10534.3,-88.8C10559.65,-78.46 10592.57,-65.22 10622,-54 10633.9,-49.46 10646.68,-44.74 10658.93,-40.29\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10659.89,-43.67 10668.1,-36.98 10657.51,-37.09 10659.89,-43.67\"/>\n", + "<text text-anchor=\"middle\" x=\"10626.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b49->b128 -->\n", + "<g id=\"edge18\" class=\"edge\">\n", + "<title>b49->b128</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10649.09,-88.77C10678.83,-84.09 10709.53,-78.31 10738,-71.25 10760,-65.79 10764.16,-60.06 10786,-54 10806.45,-48.33 10828.48,-43.19 10849.8,-38.72\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"10850.3,-42.19 10859.39,-36.74 10848.89,-35.33 10850.3,-42.19\"/>\n", + "<text text-anchor=\"middle\" x=\"10790.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b50->b129 -->\n", + "<g id=\"edge146\" class=\"edge\">\n", + "<title>b50->b129</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M10072.21,-88.8C10032.26,-74.8 9976.02,-55.1 9933.48,-40.19\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"9934.73,-36.92 9924.13,-36.92 9932.41,-43.53 9934.73,-36.92\"/>\n", + "<text text-anchor=\"middle\" x=\"10023.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b55->b130 -->\n", + "<g id=\"edge153\" class=\"edge\">\n", + "<title>b55->b130</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12466.61,-96.24C12366.08,-84.13 12188.61,-64.11 12036,-54 11908.35,-45.54 11590.56,-63.76 11447.11,-35.73\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"11447.84,-32.31 11437.33,-33.67 11446.39,-39.16 11447.84,-32.31\"/>\n", + "<text text-anchor=\"middle\" x=\"12236.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b131 -->\n", + "<g id=\"node132\" class=\"node\">\n", + "<title>b131</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"13046,-36 12850,-36 12850,0 13046,0 13046,-36\"/>\n", + "<text text-anchor=\"start\" x=\"12932.62\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">CCX</text>\n", + "<text text-anchor=\"start\" x=\"12858\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">cvs=(0, 0), target_gate=cirq.X</text>\n", + "</g>\n", + "<!-- b55->b131 -->\n", + "<g id=\"edge154\" class=\"edge\">\n", + "<title>b55->b131</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12627.18,-88.8C12693.46,-74.38 12787.58,-53.9 12856.73,-38.86\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12857.11,-42.36 12866.13,-36.81 12855.62,-35.52 12857.11,-42.36\"/>\n", + "<text text-anchor=\"middle\" x=\"12787.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b132 -->\n", + "<g id=\"node133\" class=\"node\">\n", + "<title>b132</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"13218,-36 13064,-36 13064,0 13218,0 13218,-36\"/>\n", + "<text text-anchor=\"start\" x=\"13089.25\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">HasDuplicates</text>\n", + "<text text-anchor=\"start\" x=\"13072\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">l=8, dtype=QUInt(bi ...</text>\n", + "</g>\n", + "<!-- b55->b132 -->\n", + "<g id=\"edge155\" class=\"edge\">\n", + "<title>b55->b132</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12627.28,-96.6C12725.25,-84.5 12896.17,-62.34 13052.46,-36.38\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"13052.9,-39.85 13062.19,-34.75 13051.75,-32.95 13052.9,-39.85\"/>\n", + "<text text-anchor=\"middle\" x=\"12933.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b133 -->\n", + "<g id=\"node134\" class=\"node\">\n", + "<title>b133</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"13486,-36 13236,-36 13236,0 13486,0 13486,-36\"/>\n", + "<text text-anchor=\"start\" x=\"13289\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">SimpleGuidingState</text>\n", + "<text text-anchor=\"start\" x=\"13244\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">inst=KXorInst ..., phasegrad_bitsize=30</text>\n", + "</g>\n", + "<!-- b55->b133 -->\n", + "<g id=\"edge156\" class=\"edge\">\n", + "<title>b55->b133</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12627.31,-106.78C12788.55,-107.12 13146.34,-104 13264,-71.25 13286.13,-65.09 13308.85,-53.21 13326.73,-42.33\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"13328.5,-45.35 13335.11,-37.07 13324.78,-39.42 13328.5,-45.35\"/>\n", + "<text text-anchor=\"middle\" x=\"13309.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", + "</g>\n", + "<!-- b134 -->\n", + "<g id=\"node135\" class=\"node\">\n", + "<title>b134</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"12452.25,-36 12263.75,-36 12263.75,0 12452.25,0 12452.25,-36\"/>\n", + "<text text-anchor=\"start\" x=\"12271.75\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">ProbabilisticUncompute</text>\n", + "<text text-anchor=\"start\" x=\"12328\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">bitsize=24</text>\n", + "</g>\n", + "<!-- b55->b134 -->\n", + "<g id=\"edge157\" class=\"edge\">\n", + "<title>b55->b134</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12466.61,-96.11C12431.6,-90.32 12395.49,-82.04 12382,-71.25 12374.3,-65.09 12368.96,-55.9 12365.32,-46.94\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12368.73,-46.08 12362.16,-37.77 12362.11,-48.36 12368.73,-46.08\"/>\n", + "<text text-anchor=\"middle\" x=\"12386.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "<!-- b135 -->\n", + "<g id=\"node136\" class=\"node\">\n", + "<title>b135</title>\n", + "<polygon fill=\"none\" stroke=\"black\" points=\"12624,-36 12470,-36 12470,0 12624,0 12624,-36\"/>\n", + "<text text-anchor=\"start\" x=\"12505.38\" y=\"-17.7\" font-family=\"Times,serif\" font-size=\"14.00\">SortInPlace</text>\n", + "<text text-anchor=\"start\" x=\"12478\" y=\"-7.5\" font-family=\"monospace\" font-size=\"10.00\">l=8, dtype=QUInt(bi ...</text>\n", + "</g>\n", + "<!-- b55->b135 -->\n", + "<g id=\"edge158\" class=\"edge\">\n", + "<title>b55->b135</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M12547,-89.01C12547,-77.18 12547,-61.2 12547,-47.5\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"12550.5,-47.72 12547,-37.72 12543.5,-47.72 12550.5,-47.72\"/>\n", + "<text text-anchor=\"middle\" x=\"12551.5\" y=\"-57.95\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", + "</g>\n", + "</g>\n", + "</svg>" + ], + "text/plain": [ + "<IPython.core.display.SVG object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "g, sigma = bloq.call_graph(max_depth=6)\n", + "show_call_graph(g)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "234316cd-b790-42ee-baef-d9f08bf2e19d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'toffoli': 12261972437984,\n", + " 'cswap': 5171509416110263,\n", + " 'and_bloq': 255058640186620068,\n", + " 'clifford': 373887003261338334,\n", + " 'rotation': 11450518379588*\\tilde{O}(350784) + 17649125770113,\n", + " 'measurement': 255058640186620068}" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from qualtran.resource_counting import get_cost_value, QECGatesCost\n", + "\n", + "gc = get_cost_value(bloq, QECGatesCost())\n", + "gc.asdict()" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "a3af760a-c97f-4731-b1d0-5749271f0cdb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'toffoli': 0.0158706515045947,\n", + " 'cswap': 6.69347644605456,\n", + " 'and_bloq': 330.121994003046,\n", + " 'clifford': 483.921356116957,\n", + " 'rotation': 0.0148203878020848*\\tilde{O}(350784) + 0.0228432355295913,\n", + " 'measurement': 330.121994003046}" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(gc * (1/cost_O_tilde)).asdict()" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "493750c7-2cd2-40ef-a8b1-f5b52c2a5792", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'7.726193e+14'" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f\"{cost_O_tilde:e}\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/qualtran/bloqs/phase_estimation/lp_resource_state.py b/qualtran/bloqs/phase_estimation/lp_resource_state.py index 53cadba44..f58776ac0 100644 --- a/qualtran/bloqs/phase_estimation/lp_resource_state.py +++ b/qualtran/bloqs/phase_estimation/lp_resource_state.py @@ -140,8 +140,9 @@ def from_standard_deviation_eps(cls, eps: SymbolicFloat) -> 'LPResourceState': def m_bits(self) -> SymbolicInt: return self.bitsize - def build_composite_bloq(self, bb: 'BloqBuilder', **soqs: 'SoquetT') -> Dict[str, 'SoquetT']: - qpe_reg = bb.allocate(dtype=self.m_register.dtype) + def build_composite_bloq( + self, bb: 'BloqBuilder', qpe_reg: 'Soquet', **soqs: 'SoquetT' + ) -> Dict[str, 'SoquetT']: anc, flag = bb.allocate(dtype=QBit()), bb.allocate(dtype=QBit()) flag_angle = np.arccos(1 / (1 + 2**self.bitsize)) diff --git a/qualtran/bloqs/phase_estimation/qpe_window_state.py b/qualtran/bloqs/phase_estimation/qpe_window_state.py index 5d6f0c373..eea507d2e 100644 --- a/qualtran/bloqs/phase_estimation/qpe_window_state.py +++ b/qualtran/bloqs/phase_estimation/qpe_window_state.py @@ -17,7 +17,7 @@ import attrs -from qualtran import Bloq, bloq_example, BloqDocSpec, QFxp, Register, Side, Signature +from qualtran import Bloq, bloq_example, BloqDocSpec, QFxp, Register, Signature from qualtran.bloqs.basic_gates import Hadamard, OnEach from qualtran.symbolics import ceil, log2, pi, SymbolicFloat, SymbolicInt @@ -31,7 +31,7 @@ class QPEWindowStateBase(Bloq, metaclass=abc.ABCMeta): @cached_property def m_register(self) -> 'Register': - return Register('qpe_reg', QFxp(self.m_bits, self.m_bits), side=Side.RIGHT) + return Register('qpe_reg', QFxp(self.m_bits, self.m_bits)) @property @abc.abstractmethod @@ -95,8 +95,7 @@ def from_standard_deviation_eps(cls, eps: SymbolicFloat): """ return cls(ceil(2 * log2(pi(eps) / eps))) - def build_composite_bloq(self, bb: 'BloqBuilder') -> Dict[str, 'SoquetT']: - qpe_reg = bb.allocate(dtype=self.m_register.dtype) + def build_composite_bloq(self, bb: 'BloqBuilder', qpe_reg) -> Dict[str, 'SoquetT']: qpe_reg = bb.add(OnEach(self.m_bits, Hadamard()), q=qpe_reg) return {'qpe_reg': qpe_reg} diff --git a/qualtran/bloqs/state_preparation/black_box_prepare.py b/qualtran/bloqs/state_preparation/black_box_prepare.py index 42aacba78..892db1735 100644 --- a/qualtran/bloqs/state_preparation/black_box_prepare.py +++ b/qualtran/bloqs/state_preparation/black_box_prepare.py @@ -29,8 +29,7 @@ ) from qualtran.bloqs.bookkeeping.auto_partition import AutoPartition from qualtran.bloqs.state_preparation.prepare_base import PrepareOracle -from qualtran.symbolics import ssum, SymbolicFloat, SymbolicInt -from qualtran.symbolics.types import is_symbolic +from qualtran.symbolics import is_zero, ssum, SymbolicFloat, SymbolicInt @frozen @@ -75,19 +74,19 @@ def signature(self) -> Signature: return Signature.build(selection=self.selection_bitsize, junk=self.junk_bitsize) def build_composite_bloq(self, bb: BloqBuilder, **soqs: SoquetT) -> Dict[str, SoquetT]: - if self.selection_bitsize == 0: + if is_zero(self.selection_bitsize): return soqs partitions = [ (self.selection_registers[0], [r.name for r in self.prepare.selection_registers]) ] - if is_symbolic(self.junk_bitsize) or self.junk_bitsize > 0: + if not is_zero(self.junk_bitsize): partitions.append( (self.junk_registers[0], [r.name for r in self.prepare.junk_registers]) ) return bb.add_d(AutoPartition(self.prepare, partitions), **soqs) def __str__(self) -> str: - return 'Prep' + return f'BBPrepare[{self.prepare}]' @bloq_example diff --git a/qualtran/drawing/graphviz.py b/qualtran/drawing/graphviz.py index b6e70050d..12835098e 100644 --- a/qualtran/drawing/graphviz.py +++ b/qualtran/drawing/graphviz.py @@ -402,6 +402,24 @@ def cxn_edge(self, left_id: str, right_id: str, cxn: Connection) -> pydot.Edge: arrowsize=0.25, ) + def cxn_label(self, cxn: Connection) -> str: + import sympy + + from qualtran.symbolics import is_symbolic + + n = cxn.shape + if not is_symbolic(n): + return str(n) + + label = sympy.printing.pretty(n) + label_lines = label.split('\n') + if len(label_lines) > 1: + return str(n)[:10] + " ..." + + if len(label) > 15: + return label[:15] + " ..." + return label + class TypedGraphDrawer(PrettyGraphDrawer): @staticmethod diff --git a/qualtran/symbolics/simplification.py b/qualtran/symbolics/simplification.py new file mode 100644 index 000000000..6c1cfb1ad --- /dev/null +++ b/qualtran/symbolics/simplification.py @@ -0,0 +1,23 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from qualtran.symbolics.types import SymbolicInt + + +def extract_int(x: SymbolicInt) -> SymbolicInt: + """Extract a raw python int if the input is sympy.Integer, otherwise return as-is.""" + try: + result = int(x) + return result + except TypeError: + return x