{
  "cells": [
    {
      "cell_type": "markdown",
      "id": "2abbf9e4",
      "metadata": {},
      "source": [
        "---\n",
        "title: \"Q-CTRLの Qiskit Functions を用いた量子位相推定\"\n",
        "description: \"Q-CTRL Qiskit関数を用いて35量子ビット上で量子位相推定アルゴリズムを実装する\"\n",
        "---\n",
        "\n",
        "{/* cspell:ignore eigenphase topk ylab boxstyle fontsize */}\n",
        "\n",
        "<span id=\"quantum-phase-estimation-with-q-ctrls-qiskit-functions\" />\n",
        "\n",
        "# Q-CTRLの Qiskit Functions を用いた量子位相推定\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "4170a8f8",
      "metadata": {},
      "source": [
        "*使用時間の見積もり：Heron r2 プロセッサーで40秒。 (注：これはあくまでも目安です。 実行時間は異なるかもしれない)。*\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "b2f4a24e",
      "metadata": {},
      "source": [
        "<span id=\"background\" />\n",
        "\n",
        "## 背景\n",
        "\n",
        "量子位相推定(QPE)は、量子コンピューティングにおける基礎的なアルゴリズムであり、ショールのアルゴリズム、量子化学の基底状態エネルギー推定、固有値問題など、多くの重要なアプリケーションの基礎となっている。  QPEは、ユニタリー作用素の固有状態に関連する位相 $\\varphi$ を推定します\n",
        "\n",
        "$U \\lvert \\varphi \\rangle = e^{2\\pi i \\varphi} \\lvert \\varphi \\rangle,$\n",
        "\n",
        "そして、 $m$ 計数量子ビット [\\[1\\]](#references) を使用して、 $\\epsilon = O(1/2^m)$ の精度で決定する。 これらの量子ビットを重ね合わせた状態で準備し、制御された $U$ のべき乗を適用し、逆量子フーリエ変換（QFT）を用いて位相を2進エンコードされた測定結果に抽出することで、QPEは、その2進分数が $\\varphi$ に近似するビット列をピークとする確率分布を生成する。理想的なケースでは、最も可能性の高い測定結果は位相の2進展開に直接対応し、他の結果の確率は計数量子ビットの数に応じて急激に減少します。 しかし、ディープQPE回路をハードウェア上で動作させるには課題がある。多数の量子ビットとエンタングル演算により、アルゴリズムはデコヒーレンスとゲート・エラーの影響を強く受ける。 その結果、ビット列の分布が広がってシフトし、真の固有位相を覆い隠してしまう。 その結果、最も高い確率を持つビット列は、 $\\varphi$ の正しい2進展開に対応しなくなる可能性がある。\n",
        "\n",
        "このチュートリアルでは、Qiskit 関数として提供される Q-CTRL の Fire Opal エラー抑制およびパフォーマンス管理ツールを使用して、QPE アルゴリズムの実装を紹介します ( [Fire Opal のドキュメント](/docs/guides/q-ctrl-performance-management)を参照)。 Fire Opalは、動的デカップリング、量子ビットレイアウトの改善、エラー抑制技術などの高度な最適化を自動的に適用し、より忠実な結果をもたらします。 これらの改善により、ハードウェアのビット列分布がノイズのないシミュレーションで得られた分布に近づき、ノイズの影響下でも正しい固有位相を確実に特定できるようになりました。\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "5019f20e",
      "metadata": {},
      "source": [
        "<span id=\"requirements\" />\n",
        "\n",
        "## 要件\n",
        "\n",
        "このチュートリアルを始める前に、以下のものがインストールされていることを確認してください：\n",
        "\n",
        "* Qiskit SDK v1.4 またはそれ以降、 [可視化](/docs/api/qiskit/visualization)サポート付き\n",
        "* Qiskit Runtime v0.40 またはそれ以降 (`pip install qiskit-ibm-runtime`)\n",
        "* Qiskit Functions Catalog v0.9.0 (`pip install qiskit-ibm-catalog`)\n",
        "* Fire Opal SDK v9.0.2 またはそれ以降 (`pip install fire-opal`)\n",
        "* Q-CTRL Visualizer v8.0.2 またはそれ以降 (`pip install qctrl-visualizer`)\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "360f9871",
      "metadata": {},
      "source": [
        "<span id=\"setup\" />\n",
        "\n",
        "## セットアップ\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "46eddb0f",
      "metadata": {},
      "source": [
        "まず、 [IBM Quantum](http://quantum.cloud.ibm.com/) のAPIキーを使用して認証を行ってください。 次に、次のようにQiskit関数を選択します。 （このコードは、 [アカウントが](/docs/guides/functions-get-started#install-qiskit-functions-catalog-client)すでにローカル環境に保存されていることを前提としています。）\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "id": "39896f05",
      "metadata": {},
      "outputs": [],
      "source": [
        "from qiskit import QuantumCircuit\n",
        "\n",
        "import numpy as np\n",
        "import matplotlib.pyplot as plt\n",
        "import qiskit\n",
        "from qiskit import qasm2\n",
        "from qiskit_aer import AerSimulator\n",
        "from qiskit_ibm_runtime import QiskitRuntimeService\n",
        "from qiskit_ibm_runtime import SamplerV2 as Sampler\n",
        "from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\n",
        "import qctrlvisualizer as qv\n",
        "from qiskit_ibm_catalog import QiskitFunctionsCatalog\n",
        "\n",
        "plt.style.use(qv.get_qctrl_style())"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "9abf8775",
      "metadata": {},
      "outputs": [],
      "source": [
        "catalog = QiskitFunctionsCatalog(channel=\"ibm_quantum_platform\")\n",
        "\n",
        "# Access Function\n",
        "perf_mgmt = catalog.load(\"q-ctrl/performance-management\")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "6337a6c2",
      "metadata": {},
      "source": [
        "<span id=\"step-1-map-classical-inputs-to-a-quantum-problem\" />\n",
        "\n",
        "## ステップ1：古典的な入力を量子問題にマッピングする\n",
        "\n",
        "このチュートリアルでは、既知の単一量子ビットユニタリーの固有位相を回復するためのQPEを説明します。 推定したい位相のユニタリーは、ターゲット量子ビットに適用される単一量子ビット位相ゲートである：\n",
        "\n",
        "$$\n",
        "U(\\theta)=\n",
        "\\begin{pmatrix}\n",
        "1 & 0\\\\[2pt]\n",
        "0 & e^{i\\theta}\n",
        "\\end{pmatrix}\n",
        "= e^{i\\theta\\,|1\\rangle\\!\\langle 1|}.\n",
        "$$\n",
        "\n",
        "その固有状態 $|\\psi\\rangle=|1\\rangle$ を用意する。 $|1\\rangle$ は固有値 $e^{i\\theta}$ を持つ $U(\\theta)$ の固有ベクトルなので、推定すべき固有位相は次のようになる：\n",
        "\n",
        "$$\n",
        "\\varphi = \\frac{\\theta}{2\\pi} \\pmod{1}\n",
        "$$\n",
        "\n",
        "$\\theta=\\tfrac{1}{6}\\cdot 2\\pi$ を設定するので、基底真理位相は $\\varphi=1/6$ となる。QPE回路は、角度 $\\theta\\cdot2^k$ で制御された位相回転を適用することにより、制御された累乗 $U^{2^k}$ を実装し、次に計数レジスタに逆QFTを適用して測定する。 結果のビット列は、 $1/6$ の2進表現に集中する。\n",
        "\n",
        "この回路は、 $m$ （推定精度を設定するための）計数量子ビットと1つのターゲット量子ビットを使用する。 量子フーリエ変換（QFT）とその逆変換、固有位相の10進数と2進数の間のマッピングを行うユーティリティ関数、シミュレーションとハードウェアの結果を比較するために生のカウントを確率に正規化するヘルパーなどです。\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "id": "4c5cd3d4",
      "metadata": {},
      "outputs": [],
      "source": [
        "def inverse_quantum_fourier_transform(quantum_circuit, number_of_qubits):\n",
        "    \"\"\"\n",
        "    Apply an inverse Quantum Fourier Transform the first `number_of_qubits` qubits in the\n",
        "    `quantum_circuit`.\n",
        "    \"\"\"\n",
        "    for qubit in range(number_of_qubits // 2):\n",
        "        quantum_circuit.swap(qubit, number_of_qubits - qubit - 1)\n",
        "    for j in range(number_of_qubits):\n",
        "        for m in range(j):\n",
        "            quantum_circuit.cp(-np.pi / float(2 ** (j - m)), m, j)\n",
        "        quantum_circuit.h(j)\n",
        "    return quantum_circuit"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "id": "6d56f133",
      "metadata": {},
      "outputs": [],
      "source": [
        "def bitstring_count_to_probabilities(data, shot_count):\n",
        "    \"\"\"\n",
        "    This function turns an unsorted dictionary of bitstring counts into a sorted dictionary\n",
        "    of probabilities.\n",
        "    \"\"\"\n",
        "    # Turn the bitstring counts into probabilities.\n",
        "    probabilities = {\n",
        "        bitstring: bitstring_count / shot_count\n",
        "        for bitstring, bitstring_count in data.items()\n",
        "    }\n",
        "\n",
        "    sorted_probabilities = dict(\n",
        "        sorted(probabilities.items(), key=lambda x: x[1], reverse=True)\n",
        "    )\n",
        "\n",
        "    return sorted_probabilities"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "d33b21fd",
      "metadata": {},
      "source": [
        "<span id=\"step-2-optimize-problem-for-quantum-hardware-execution\" />\n",
        "\n",
        "## ステップ2：量子ハードウェア実行に向けた問題の最適化\n",
        "\n",
        "QPE回路は、計数量子ビットを重ね合わせた状態で準備し、制御された位相回転を適用して目的の固有位相をエンコードし、測定前に逆QFTで仕上げることで構築する。\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "id": "79d62a79",
      "metadata": {},
      "outputs": [],
      "source": [
        "def quantum_phase_estimation_benchmark_circuit(\n",
        "    number_of_counting_qubits, phase\n",
        "):\n",
        "    \"\"\"\n",
        "    Create the circuit for quantum phase estimation.\n",
        "\n",
        "    Parameters\n",
        "    ----------\n",
        "    number_of_counting_qubits : The number of qubits in the circuit.\n",
        "    phase : The desired phase.\n",
        "\n",
        "    Returns\n",
        "    -------\n",
        "    QuantumCircuit\n",
        "        The quantum phase estimation circuit for `number_of_counting_qubits` qubits.\n",
        "    \"\"\"\n",
        "    qc = QuantumCircuit(\n",
        "        number_of_counting_qubits + 1, number_of_counting_qubits\n",
        "    )\n",
        "    target = number_of_counting_qubits\n",
        "\n",
        "    # |1> eigenstate for the single-qubit phase gate\n",
        "    qc.x(target)\n",
        "\n",
        "    # Hadamards on counting register\n",
        "    for q in range(number_of_counting_qubits):\n",
        "        qc.h(q)\n",
        "\n",
        "    # ONE controlled phase per counting qubit: cp(phase * 2**k)\n",
        "    for k in range(number_of_counting_qubits):\n",
        "        qc.cp(phase * (1 << k), k, target)\n",
        "\n",
        "    qc.barrier()\n",
        "\n",
        "    # Inverse QFT on counting register\n",
        "    inverse_quantum_fourier_transform(qc, number_of_counting_qubits)\n",
        "\n",
        "    qc.barrier()\n",
        "    for q in range(number_of_counting_qubits):\n",
        "        qc.measure(q, q)\n",
        "    return qc"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "0e550ad5",
      "metadata": {},
      "source": [
        "<span id=\"step-3-execute-using-qiskit-primitives\" />\n",
        "\n",
        "## ステップ3: `Qiskit primitives`を使用して実行する\n",
        "\n",
        "実験のショット数と量子ビット数を設定し、 $m$ 2進数を使ってターゲット位相 $\\varphi = 1/6$ をエンコードする。 これらのパラメータを使って、シミュレーション、デフォルトのハードウェア、Fire Opalで強化されたバックエンドで実行されるQPE回路を構築する。\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "id": "19e6dd45",
      "metadata": {},
      "outputs": [],
      "source": [
        "shot_count = 10000\n",
        "num_qubits = 35\n",
        "phase = (1 / 6) * 2 * np.pi\n",
        "circuits_quantum_phase_estimation = (\n",
        "    quantum_phase_estimation_benchmark_circuit(\n",
        "        number_of_counting_qubits=num_qubits, phase=phase\n",
        "    )\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "6c53f759",
      "metadata": {},
      "source": [
        "<span id=\"run-mps-simulation\" />\n",
        "\n",
        "### MPSシミュレーションを実行する\n",
        "\n",
        "まず、 `matrix_product_state` シミュレータを使って参照分布を生成し、後でハードウェアの結果と比較するために、カウント数を正規化された確率に変換する。\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "id": "1fabc3a2",
      "metadata": {},
      "outputs": [],
      "source": [
        "# Run the algorithm on the IBM Aer simulator.\n",
        "aer_simulator = AerSimulator(method=\"matrix_product_state\")\n",
        "\n",
        "# Transpile the circuits for the simulator.\n",
        "transpiled_circuits = qiskit.transpile(\n",
        "    circuits_quantum_phase_estimation, aer_simulator\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "id": "99eca1f1",
      "metadata": {},
      "outputs": [],
      "source": [
        "simulated_result = (\n",
        "    aer_simulator.run(transpiled_circuits, shots=shot_count)\n",
        "    .result()\n",
        "    .get_counts()\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "id": "263624e9",
      "metadata": {},
      "outputs": [],
      "source": [
        "simulated_result_probabilities = []\n",
        "\n",
        "simulated_result_probabilities.append(\n",
        "    bitstring_count_to_probabilities(\n",
        "        simulated_result,\n",
        "        shot_count=shot_count,\n",
        "    )\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "df203619",
      "metadata": {},
      "source": [
        "<span id=\"run-on-hardware\" />\n",
        "\n",
        "### ハードウェア上で実行する\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "41bf548b",
      "metadata": {},
      "outputs": [],
      "source": [
        "service = QiskitRuntimeService()\n",
        "backend = service.least_busy(operational=True, simulator=False)\n",
        "\n",
        "pm = generate_preset_pass_manager(backend=backend, optimization_level=3)\n",
        "isa_circuits = pm.run(circuits_quantum_phase_estimation)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "id": "b2bdb8b8",
      "metadata": {},
      "outputs": [],
      "source": [
        "# Run the algorithm with IBM default.\n",
        "sampler = Sampler(backend)\n",
        "\n",
        "# Run all circuits using IBM Quantum Compute Service.\n",
        "ibm_default_job = sampler.run([isa_circuits], shots=shot_count)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "945967d0",
      "metadata": {},
      "source": [
        "<span id=\"run-on-hardware-with-fire-opal\" />\n",
        "\n",
        "### Fire Opal搭載ハードウェアで動作する\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "ca892a3c",
      "metadata": {},
      "outputs": [],
      "source": [
        "# Run the circuit using Sampler\n",
        "fire_opal_job = perf_mgmt.run(\n",
        "    primitive=\"sampler\",\n",
        "    pubs=[qasm2.dumps(circuits_quantum_phase_estimation)],\n",
        "    backend_name=backend.name,\n",
        "    options={\"default_shots\": shot_count},\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "000a119c",
      "metadata": {},
      "source": [
        "<span id=\"step-4-post-process-and-return-result-in-desired-classical-format\" />\n",
        "\n",
        "## ステップ4：後処理を行い、結果を希望の古典形式で返す\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "dff71917",
      "metadata": {},
      "outputs": [],
      "source": [
        "# Retrieve results.\n",
        "ibm_default_result = ibm_default_job.result()\n",
        "ibm_default_probabilities = []\n",
        "\n",
        "for idx, pub_result in enumerate(ibm_default_result):\n",
        "    ibm_default_probabilities.append(\n",
        "        bitstring_count_to_probabilities(\n",
        "            pub_result.data.c0.get_counts(),\n",
        "            shot_count=shot_count,\n",
        "        )\n",
        "    )"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "be4e50e5",
      "metadata": {},
      "outputs": [],
      "source": [
        "fire_opal_result = fire_opal_job.result()\n",
        "\n",
        "fire_opal_probabilities = []\n",
        "for idx, pub_result in enumerate(fire_opal_result):\n",
        "    fire_opal_probabilities.append(\n",
        "        bitstring_count_to_probabilities(\n",
        "            pub_result.data.c0.get_counts(),\n",
        "            shot_count=shot_count,\n",
        "        )\n",
        "    )"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "id": "c0134366",
      "metadata": {},
      "outputs": [],
      "source": [
        "data = {\n",
        "    \"simulation\": simulated_result_probabilities,\n",
        "    \"default\": ibm_default_probabilities,\n",
        "    \"fire_opal\": fire_opal_probabilities,\n",
        "}"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "id": "a6dc6744",
      "metadata": {},
      "outputs": [],
      "source": [
        "def plot_distributions(\n",
        "    data,\n",
        "    number_of_counting_qubits,\n",
        "    top_k=None,\n",
        "    by=\"prob\",\n",
        "    shot_count=None,\n",
        "):\n",
        "    def nrm(d):\n",
        "        s = sum(d.values())\n",
        "        return {k: (v / s if s else 0.0) for k, v in d.items()}\n",
        "\n",
        "    def as_float(d):\n",
        "        return {k: float(v) for k, v in d.items()}\n",
        "\n",
        "    def to_space(d):\n",
        "        if by == \"prob\":\n",
        "            return nrm(as_float(d))\n",
        "        else:\n",
        "            if shot_count and 0.99 <= sum(d.values()) <= 1.01:\n",
        "                return {\n",
        "                    k: v * float(shot_count) for k, v in as_float(d).items()\n",
        "                }\n",
        "            else:\n",
        "                return as_float(d)\n",
        "\n",
        "    def topk(d, k):\n",
        "        items = sorted(d.items(), key=lambda kv: kv[1], reverse=True)\n",
        "        return items[: (k or len(d))]\n",
        "\n",
        "    phase = \"1/6\"\n",
        "\n",
        "    sim = to_space(data[\"simulation\"])\n",
        "    dft = to_space(data[\"default\"])\n",
        "    qct = to_space(data[\"fire_opal\"])\n",
        "\n",
        "    correct = max(sim, key=sim.get) if sim else None\n",
        "    print(\"Correct result:\", correct)\n",
        "\n",
        "    sim_items = topk(sim, top_k)\n",
        "    dft_items = topk(dft, top_k)\n",
        "    qct_items = topk(qct, top_k)\n",
        "\n",
        "    sim_keys, y_sim = zip(*sim_items) if sim_items else ([], [])\n",
        "    dft_keys, y_dft = zip(*dft_items) if dft_items else ([], [])\n",
        "    qct_keys, y_qct = zip(*qct_items) if qct_items else ([], [])\n",
        "\n",
        "    fig, axes = plt.subplots(3, 1, layout=\"constrained\")\n",
        "    ylab = \"Probabilities\"\n",
        "\n",
        "    def panel(ax, keys, ys, title, color):\n",
        "        x = np.arange(len(keys))\n",
        "        bars = ax.bar(x, ys, color=color)\n",
        "        ax.set_title(title)\n",
        "        ax.set_ylabel(ylab)\n",
        "        ax.set_xticks(x)\n",
        "        ax.set_xticklabels(keys, rotation=90)\n",
        "        ax.set_xlabel(\"Bitstrings\")\n",
        "        if correct in keys:\n",
        "            i = keys.index(correct)\n",
        "            bars[i].set_edgecolor(\"black\")\n",
        "            bars[i].set_linewidth(2)\n",
        "        return max(ys, default=0.0)\n",
        "\n",
        "    c_sim, c_dft, c_qct = (\n",
        "        qv.QCTRL_STYLE_COLORS[5],\n",
        "        qv.QCTRL_STYLE_COLORS[1],\n",
        "        qv.QCTRL_STYLE_COLORS[0],\n",
        "    )\n",
        "    m1 = panel(axes[0], list(sim_keys), list(y_sim), \"Simulation\", c_sim)\n",
        "    m2 = panel(axes[1], list(dft_keys), list(y_dft), \"Default\", c_dft)\n",
        "    m3 = panel(axes[2], list(qct_keys), list(y_qct), \"Q-CTRL\", c_qct)\n",
        "\n",
        "    for ax, m in zip(axes, (m1, m2, m3)):\n",
        "        ax.set_ylim(0, 1.05 * (m or 1.0))\n",
        "\n",
        "    for ax in axes:\n",
        "        ax.label_outer()\n",
        "    fig.suptitle(\n",
        "        rf\"{number_of_counting_qubits} counting qubits, $2\\pi\\varphi$={phase}\"\n",
        "    )\n",
        "    fig.set_size_inches(20, 10)\n",
        "    plt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "id": "593334d2",
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Correct result: 00101010101010101010101010101010101\n"
          ]
        },
        {
          "data": {
            "text/plain": [
              "<Image src=\"/docs/images/tutorials/quantum-phase-estimation-qctrl/extracted-outputs/593334d2-1.avif\" alt=\"Output of the previous code cell\" />"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "experiment_index = 0\n",
        "phase_index = 0\n",
        "\n",
        "distributions = {\n",
        "    \"simulation\": data[\"simulation\"][phase_index],\n",
        "    \"default\": data[\"default\"][phase_index],\n",
        "    \"fire_opal\": data[\"fire_opal\"][phase_index],\n",
        "}\n",
        "\n",
        "plot_distributions(\n",
        "    distributions, num_qubits, top_k=100, by=\"prob\", shot_count=shot_count\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "a5199fb3",
      "metadata": {},
      "source": [
        "シミュレーションは、正しい固有相のベースラインを設定する。 デフォルトのハードウェア動作では、ノイズが多くの不正確なビット列に確率を分散させるため、この結果が不明瞭になる。 Q-CTRL Performance Managementを使用することで、分布がよりシャープになり、正しい結果が回復されるため、この規模でも信頼性の高いQPEが可能になります。\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "c72c6bb0",
      "metadata": {},
      "source": [
        "<span id=\"references\" />\n",
        "\n",
        "## 参照\n",
        "\n",
        "\\[1] 第7講[位相推定と因数分解](/learning/courses/fundamentals-of-quantum-algorithms/phase-estimation-and-factoring/introduction). IBM Quantum Learning - 量子アルゴリズムの基礎 2025年10月3日取得。\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "4760c8b9",
      "metadata": {},
      "source": [
        "<span id=\"tutorial-survey\" />\n",
        "\n",
        "## チュートリアル調査\n",
        "\n",
        "このチュートリアルに関するフィードバックをお寄せください。 あなたの洞察は、私たちのコンテンツの提供とユーザーエクスペリエンスを向上させるのに役立ちます。\n",
        "\n",
        "[アンケートへのリンク](https://your.feedback.ibm.com/jfe/form/SV_3BLFkNVEuh0QBWm)\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "id": "a1b8767d",
      "source": "© IBM Corp., 2017-2026"
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "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"
    },
    "hours": 1,
    "qpuSeconds": 40
  },
  "nbformat": 4,
  "nbformat_minor": 5
}