From 89eb7dddfbab2b8e479a977a3503d0144771ff4d Mon Sep 17 00:00:00 2001 From: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:03:43 +0100 Subject: [PATCH 1/2] [QA v0.40.0] Fix liesim_extension demo (#1298) The order of the operators in the lie closure changed with https://github.com/PennyLaneAI/pennylane/pull/6724 such that the hard-coded indices are not correct anymore. I changed the latter part where we pick the gate in the moment space according to the $p = O_1 O_2$ that is not in the moment space to automatically pick it from the list (instead of hard-coding the index). However, the first choice of $p$ is hard to automate, the only thing that matters is that $p = O_1 O_2$ is not in the DLA Note for reviewers: The important thing to look at is that the outputs are now again `True` --- demonstrations/tutorial_liesim_extension.metadata.json | 2 +- demonstrations/tutorial_liesim_extension.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/demonstrations/tutorial_liesim_extension.metadata.json b/demonstrations/tutorial_liesim_extension.metadata.json index c91f1393be..7da2c15c82 100644 --- a/demonstrations/tutorial_liesim_extension.metadata.json +++ b/demonstrations/tutorial_liesim_extension.metadata.json @@ -6,7 +6,7 @@ } ], "dateOfPublication": "2024-06-18T00:00:00+00:00", - "dateOfLastModification": "2024-10-07T00:00:00+00:00", + "dateOfLastModification": "2025-01-13T00:00:00+00:00", "categories": [ "Quantum Computing", "Quantum Machine Learning" diff --git a/demonstrations/tutorial_liesim_extension.py b/demonstrations/tutorial_liesim_extension.py index b0f3226e98..07cd8b039e 100644 --- a/demonstrations/tutorial_liesim_extension.py +++ b/demonstrations/tutorial_liesim_extension.py @@ -133,7 +133,7 @@ def TFIM(n): # # For that, let us construct a concrete example. First we pick two elements from :math:`\mathfrak{g}` such that their product is not in :math:`\mathfrak{g}.` -p = dla[-5] @ dla[-2] +p = dla[-5] @ dla[-1] p = next(iter(p)) # strip any scalar coefficients dla_vspace = qml.pauli.PauliVSpace(dla, dtype=complex) dla_vspace.is_independent(p.pauli_rep) @@ -414,9 +414,11 @@ def Moment_step(ops, dla): # # We can now choose arbitrary DLA gates and a maximum of `one` :math:`P` gate to evolve the expectation value vector. +P_index = Moment[comp_moment].index(1.*p) # pick the gate in the Moment space that p corrresponds to + e_t = e_in e_t = expm(0.5 * adjoint_repr[dim_g-1]) @ e_t # the same U gate -e_t = expm(0.5 * adjoint_repr[74]) @ e_t # the same P gate +e_t = expm(0.5 * adjoint_repr[P_index]) @ e_t # the same P gate e_t = expm(0.5 * adjoint_repr[dim_g-2]) @ e_t # the same V gate ############################################################################## From b5b4de0e59a7265efc58eb7b35b497a3d718c4e8 Mon Sep 17 00:00:00 2001 From: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:54:51 +0100 Subject: [PATCH 2/2] [QA v.0.40.0] Fix liesim_extension demo small typoe (#1299) https://github.com/PennyLaneAI/qml/pull/1298#discussion_r1913264329 --- demonstrations/tutorial_liesim_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demonstrations/tutorial_liesim_extension.py b/demonstrations/tutorial_liesim_extension.py index 07cd8b039e..b11a640b6e 100644 --- a/demonstrations/tutorial_liesim_extension.py +++ b/demonstrations/tutorial_liesim_extension.py @@ -414,7 +414,7 @@ def Moment_step(ops, dla): # # We can now choose arbitrary DLA gates and a maximum of `one` :math:`P` gate to evolve the expectation value vector. -P_index = Moment[comp_moment].index(1.*p) # pick the gate in the Moment space that p corrresponds to +P_index = Moment[comp_moment].index(1.*p) # pick the gate in the Moment space that p corresponds to e_t = e_in e_t = expm(0.5 * adjoint_repr[dim_g-1]) @ e_t # the same U gate