From 336fcb770f17eccfd422705d6073fefbb3933e28 Mon Sep 17 00:00:00 2001 From: Katy McClintic <8239561+katymccl@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:32:53 -0700 Subject: [PATCH] Update estimation-dynamics.ipynb --- .../estimation-dynamics.ipynb | 227 +++++++++++++++++- 1 file changed, 215 insertions(+), 12 deletions(-) diff --git a/samples/azure-quantum/resource-estimation/estimation-dynamics.ipynb b/samples/azure-quantum/resource-estimation/estimation-dynamics.ipynb index ded643f5..4e50db0a 100644 --- a/samples/azure-quantum/resource-estimation/estimation-dynamics.ipynb +++ b/samples/azure-quantum/resource-estimation/estimation-dynamics.ipynb @@ -332,20 +332,164 @@ ] }, { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Finally, we are presenting the experimental results using a summary table." - ] + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualizing and understanding the results\n", + "\n", + "### Result summary table" + ] }, { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "results.summary_data_frame(labels=labels)" - ] + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "results.summary_data_frame(labels=labels)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Space chart\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The distribution of physical qubits used for the execution of the algorithm instructions and the supporting T factories can provide us valuable information to guide us in applying space and time optimizations. We can visualize this distribution for each set of qubit parameters to understand the differences in physical qubit distribution for each configuration.\n", + "\n", + "To show the space chart for a configuration from our experiment, use the following syntax:\n", + "\n", + "```\n", + " # Use the index of the desired configuration you want to visualize to get the results for that configuration.\n", + " \n", + " results[].diagram.space\n", + "\n", + " # For example, this command will produce a chart showing the distribution of physical qubits for the Gate-based µs, 10⁻³ configuration set.\n", + " results[0].diagram.space \n", + "```\n", + "\n", + "Below, let's visualize the space diagrams for each configuration." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "> You must run the `results[].diagram.space` command in a separate code cell per label.\n", + ">\n", + "> You cannot visualize the time and space diagrams in the same cell.\n", + ">\n", + "> If you run an algorithm which only has one configured set of qubit parameters and one result set, specifying the label would not be necessary. You could simply run `result.diagram.time`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# \"Gate-based µs, 10⁻³\"\n", + "results[0].diagram.space" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# \"Gate-based µs, 10⁻⁴\"\n", + "results[1].diagram.space" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# \"Gate-based ns, 10⁻³\"\n", + "results[2].diagram.space" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# \"Gate-based ns, 10⁻⁴\"\n", + "results[3].diagram.space" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# \"Majorana ns, 10⁻⁴\"\n", + "results[4].diagram.space" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + " # \"Majorana ns, 10⁻⁶\"\n", + "results[5].diagram.space" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Time chart\n", + "We can also visualize the time required to execute the algorithm as it relates to each T factory invocation runtime and the number of T factory invocations.\n", + "\n", + "\n", + "To show the time chart for a configuration from our experiment, use the following syntax:\n", + "\n", + "```\n", + " # Use the index of the desired configuration you want to visualize to get the results for that configuration.\n", + " \n", + " results[].diagram.time\n", + "\n", + " # For example, this command will produce a chart showing the distribution of physical qubits for the Gate-based µs, 10⁻³ configuration set.\n", + " results[0].diagram.time\n", + "```\n", + "\n", + "Below, let's visualize the space diagrams for each configuration set." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "> You must run the `results[].diagram.time` command in a separate code cell per label.\n", + ">\n", + "> You cannot visualize the time and space diagrams in the same cell.\n", + ">\n", + "> If you run an algorithm which only has one configured set of qubit parameters and one result set, specifying the label would not be necessary. You could simply run `result.diagram.time`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Feel free to try out different configuration sets by changing the index. \n", + "# This example produces the time diagram for the Gate-based µs, 10⁻³ configuration set.\n", + "results[0].diagram.time" + ] }, { "cell_type": "markdown", @@ -418,6 +562,64 @@ "most cases the code distance is higher." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To better understand how the balanced implementation changed the space distribution and runtime of the algorithm, try visualizing the new result set using the space and time diagrams discussed above." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Feel free to try out different configuration sets by changing the index. \n", + "# This example produces the time diagram for the Gate-based µs, 10⁻³ configuration set.\n", + "results_balanced[0].diagram.space" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Feel free to try out different configuration sets by changing the index. \n", + "# This example produces the time diagram for the Gate-based µs, 10⁻³ configuration set.\n", + "results_balanced[0].diagram.time" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You could even compare the previous implementation with the balanced implementation by re-running the space and time diagrams with the original result set and comparing to the new diagrams." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Feel free to try out different configuration sets by changing the index. \n", + "# This example produces the time diagram for the Gate-based µs, 10⁻³ configuration set.\n", + "results[0].diagram.space" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Feel free to try out different configuration sets by changing the index. \n", + "# This example produces the time diagram for the Gate-based µs, 10⁻³ configuration set.\n", + "results[0].diagram.time" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -433,6 +635,7 @@ " model instance\n", "* explore space- and time-trade-offs by changing the value for\n", " `logical_depth_factor`\n", + "* Visualize these trade-offs with the space and time diagrams.\n", "* use other or customized qubit parameters" ] }