From 43f3d77b06600114fee26ece323a60480ce658e6 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Mon, 25 Nov 2024 10:24:34 +0100 Subject: [PATCH 1/4] Installation note in ZNE Catalyst tutorial --- demonstrations/tutorial_zne_catalyst.py | 32 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/demonstrations/tutorial_zne_catalyst.py b/demonstrations/tutorial_zne_catalyst.py index 8923930398..65980dad49 100644 --- a/demonstrations/tutorial_zne_catalyst.py +++ b/demonstrations/tutorial_zne_catalyst.py @@ -71,19 +71,27 @@ These three stages illustrate what happens behind the scenes when using a ZNE routine. However, from the user's perspective, one only needs to define the initial circuit, the noise scaling method, and the extrapolation method. The rest is taken care of by Catalyst. - -Defining the mirror circuit ---------------------------- - -The first step for demoing an error mitigation routine is to define a circuit. -Here we build a simple mirror circuit starting off a `unitary 2-design `__. -This is a typical construction for a randomized benchmarking circuit, which is used in many tasks -in quantum computing. Given such circuit, we measure the expectation value :math:`\langle Z\rangle` -on the state of the first qubit, and by construction of the circuit, we expect this value to be -equal to 1. """ -import timeit +############################################################################## +# .. note :: +# +# To follow along this demonstration, it is required to install Catalyst, as well as the PennyLane-Qrack plugin. +# +# .. code-block:: bash +# +# pip install -U pennylane-catalyst pennylane-qrack +# + +############################################################################## +# Defining the mirror circuit +# --------------------------- +# The first step for demoing an error mitigation routine is to define a circuit. +# Here we build a simple mirror circuit starting off a `unitary 2-design `__. +# This is a typical construction for a randomized benchmarking circuit, which is used in many tasks +# in quantum computing. Given such circuit, we measure the expectation value :math:`\langle Z\rangle` +# on the state of the first qubit, and by construction of the circuit, we expect this value to be +# equal to 1. import numpy as np import pennylane as qml @@ -214,6 +222,8 @@ def mitigated_circuit(w1, w2): # Note: for the purpose of this last example, we reduce the number of shots of the simulator to 100, # since we don't need the accuracy required for the previous demonstration. We do so in order to # reduce the running time of this tutorial, while still showcasing the performance differences. +import timeit + noisy_device = qml.device("qrack.simulator", n_wires, shots=100, noise=NOISE_LEVEL) noisy_qnode = qml.QNode(circuit, device=noisy_device, mcm_method="one-shot") From 300e0d381261375d9e8a3e268dbe0b1f704de2eb Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Mon, 25 Nov 2024 10:38:16 +0100 Subject: [PATCH 2/4] update date in metadata file --- demonstrations/tutorial_zne_catalyst.metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demonstrations/tutorial_zne_catalyst.metadata.json b/demonstrations/tutorial_zne_catalyst.metadata.json index 7019dbd9aa..f9cc710683 100644 --- a/demonstrations/tutorial_zne_catalyst.metadata.json +++ b/demonstrations/tutorial_zne_catalyst.metadata.json @@ -9,7 +9,7 @@ } ], "dateOfPublication": "2024-11-15T00:00:00+00:00", - "dateOfLastModification": "2024-11-15T00:00:00+00:00", + "dateOfLastModification": "2024-11-25T09:00:00+00:00", "categories": [ "Algorithms", "Quantum Computing" From 8d3c86bde2330eb9a07e439b2e4460be5df759ed Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Mon, 25 Nov 2024 10:44:35 +0100 Subject: [PATCH 3/4] Update demonstrations/tutorial_zne_catalyst.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ivana Kurečić --- demonstrations/tutorial_zne_catalyst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demonstrations/tutorial_zne_catalyst.py b/demonstrations/tutorial_zne_catalyst.py index 65980dad49..a2cd49835d 100644 --- a/demonstrations/tutorial_zne_catalyst.py +++ b/demonstrations/tutorial_zne_catalyst.py @@ -76,7 +76,7 @@ ############################################################################## # .. note :: # -# To follow along this demonstration, it is required to install Catalyst, as well as the PennyLane-Qrack plugin. +# To follow along with this demonstration, it is required to install Catalyst, as well as the PennyLane-Qrack plugin. # # .. code-block:: bash # From 2e3e644669f673ba4067359fa1ea43de923bb931 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Mon, 25 Nov 2024 11:05:23 +0100 Subject: [PATCH 4/4] add links to installation notes --- demonstrations/tutorial_zne_catalyst.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demonstrations/tutorial_zne_catalyst.py b/demonstrations/tutorial_zne_catalyst.py index a2cd49835d..0addd8d542 100644 --- a/demonstrations/tutorial_zne_catalyst.py +++ b/demonstrations/tutorial_zne_catalyst.py @@ -76,7 +76,9 @@ ############################################################################## # .. note :: # -# To follow along with this demonstration, it is required to install Catalyst, as well as the PennyLane-Qrack plugin. +# To follow along with this demonstration, it is required to +# `install Catalyst `__, +# as well as the `PennyLane-Qrack plugin `__. # # .. code-block:: bash #