From 95a1af8e54ad5245807a947ccf2874a38b37953e Mon Sep 17 00:00:00 2001 From: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:02:45 -0400 Subject: [PATCH] Update tutorial_adaptive_circuits.py (#935) Fix dimensional issue in `adaptive_cirucits` Fix issue with complex coeffs in `tapering_demo` (provisional fix) --- demonstrations/tutorial_adaptive_circuits.py | 2 +- demonstrations/tutorial_qubit_tapering.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/demonstrations/tutorial_adaptive_circuits.py b/demonstrations/tutorial_adaptive_circuits.py index cd175fb567..df0ee60189 100644 --- a/demonstrations/tutorial_adaptive_circuits.py +++ b/demonstrations/tutorial_adaptive_circuits.py @@ -346,7 +346,7 @@ def circuit(params): t1 = time.time() params, energy = opt.step_and_cost(circuit, params) t2 = time.time() - print("n = {:}, E = {:.8f} H, t = {:.2f} s".format(n, energy[0], t2 - t1)) + print("n = {:}, E = {:.8f} H, t = {:.2f} s".format(n, energy, t2 - t1)) ############################################################################## # Using the sparse method reproduces the ground state energy while the optimization time is diff --git a/demonstrations/tutorial_qubit_tapering.py b/demonstrations/tutorial_qubit_tapering.py index 5a77fe3458..d75771ab06 100644 --- a/demonstrations/tutorial_qubit_tapering.py +++ b/demonstrations/tutorial_qubit_tapering.py @@ -167,6 +167,7 @@ # eigenvalues. H_tapered = qml.taper(H, generators, paulixops, paulix_sector) +H_tapered = qml.Hamiltonian(np.real(H_tapered.coeffs), H_tapered.ops) print(H_tapered) ##############################################################################