Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toric code and classical kernels demos #740

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion demonstrations/tutorial_classical_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,10 @@ def probabilities_threshold_normalize(probabilities, thresh = 1.e-10):
# itself, in case it is of use later:

def fourier_q(d, thetas, amplitudes):
return np.real(coefficients(lambda x: QK(x, thetas, amplitudes), 1, d-1))
def QK_partial(x):
squeezed_x = qml.math.squeeze(x)
return QK(squeezed_x, thetas, amplitudes)
return np.real(coefficients(QK_partial, 1, d-1))

###############################################################################
# And with this, we can finally visualize how the Fourier spectrum of the
Expand Down
2 changes: 1 addition & 1 deletion demonstrations/tutorial_toric_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def excitations(x_sites, z_sites):
# expectation value is :math:`-1`, then a quasiparticle exists in that location.
#

occupation_numbers = lambda expvals: 0.5 * (1 - expvals)
occupation_numbers = lambda expvals: [0.5 * (1 - val) for val in expvals]

def print_info(x_expvals, z_expvals):
E = -sum(x_expvals) - sum(z_expvals)
Expand Down