diff --git a/demonstrations_v2/tutorial_apply_qsvt/demo.py b/demonstrations_v2/tutorial_apply_qsvt/demo.py index 3aa593a78c..6d26a14a65 100644 --- a/demonstrations_v2/tutorial_apply_qsvt/demo.py +++ b/demonstrations_v2/tutorial_apply_qsvt/demo.py @@ -78,6 +78,12 @@ def my_circuit(): # This ultimately requires computing :math:`\vec{x} = A^{-1} \cdot \vec{b},` where for simplicity we # assume that :math:`A` is invertible. # +# .. note:: +# Be careful to follow the notation in this section carefully. +# :math:`x` is a scalar and :math:`\vec{x}` is a vector. Sometimes we are talking about the scalar +# function :math:`P(x) = s \cdot \frac{1}{x}` and sometimes we are talking about the matrix-vector +# function :math:`A \cdot \vec{x} = \vec{b}.` +# # :math:`A^{-1}` can be constructed directly by inverting the singular values of :math:`A^{T}.` We can # leverage QSVT to accomplish this by finding the phase angles which apply a polynomial approximation # to the transformation :math:`\frac{1}{x}.` This may seem simple in theory, but in practice there are diff --git a/demonstrations_v2/tutorial_apply_qsvt/metadata.json b/demonstrations_v2/tutorial_apply_qsvt/metadata.json index 2f11452eb8..c4ef462025 100644 --- a/demonstrations_v2/tutorial_apply_qsvt/metadata.json +++ b/demonstrations_v2/tutorial_apply_qsvt/metadata.json @@ -11,7 +11,7 @@ "executable_stable": true, "executable_latest": true, "dateOfPublication": "2023-08-22T00:00:00+00:00", - "dateOfLastModification": "2024-12-05T00:00:00+00:00", + "dateOfLastModification": "2025-08-22T00:00:00+00:00", "categories": [ "Quantum Computing", "Algorithms", diff --git a/demonstrations_v2/tutorial_intro_qsvt/demo.py b/demonstrations_v2/tutorial_intro_qsvt/demo.py index 9e77e09d63..200315712f 100644 --- a/demonstrations_v2/tutorial_intro_qsvt/demo.py +++ b/demonstrations_v2/tutorial_intro_qsvt/demo.py @@ -93,10 +93,20 @@ :math:`(5 x^3 - 3x)/2`. As you will soon learn, QSP can be viewed as a special case of QSVT. We thus use the :func:`~.pennylane.qsvt` operation to construct the output matrix and compare the resulting transformation to -the target polynomial. +the target polynomial. This function implements alternate products of :math:`U(a)` and :math:`S(\phi)` +as described above: """ +target_poly = [0, -3 * 0.5, 0, 5 * 0.5] +a = 0.5 +qml.draw_mpl(qml.qsvt(a, target_poly, encoding_wires=[0], block_encoding="embedding").decomposition)() + +############################################################################## +# In this figure :math:`\Pi_\phi` are phase angle rotations (:math:`S(\phi)`) and `BlockEncode` calls +# are implementations of a block encoding of the scalar :math:`a`. (this needs to be rewritten because +# block encoding is not explaine yet in the demo) + import pennylane as qml import numpy as np import matplotlib.pyplot as plt @@ -115,8 +125,8 @@ def qsvt_output(a): qsvt = [np.real(qsvt_output(a)) for a in a_vals] # neglect small imaginary part target = [np.polyval(target_poly[::-1], a) for a in a_vals] # evaluate polynomial -plt.plot(a_vals, target, label="target") -plt.plot(a_vals, qsvt, "*", label="qsvt") +plt.plot(a_vals, target, label="target polynomial: (5x^3 - 3x)/2") +plt.plot(a_vals, qsvt, "*", label="qsvt circuit matrix top left entry") plt.legend() plt.show() diff --git a/demonstrations_v2/tutorial_intro_qsvt/metadata.json b/demonstrations_v2/tutorial_intro_qsvt/metadata.json index 28f7b8f18b..573c540eb4 100644 --- a/demonstrations_v2/tutorial_intro_qsvt/metadata.json +++ b/demonstrations_v2/tutorial_intro_qsvt/metadata.json @@ -8,7 +8,7 @@ "executable_stable": true, "executable_latest": true, "dateOfPublication": "2023-05-23T00:00:00+00:00", - "dateOfLastModification": "2025-01-21T00:00:00+00:00", + "dateOfLastModification": "2025-08-22T00:00:00+00:00", "categories": [ "Algorithms", "Quantum Computing"