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

Small fixes to some demos during feature freeze for PL 0.39 #1252

Merged
merged 5 commits into from
Oct 30, 2024
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
2 changes: 1 addition & 1 deletion demonstrations/tutorial_fermionic_operators.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"dateOfPublication": "2023-06-27T00:00:00+00:00",
"dateOfLastModification": "2024-10-07T00:00:00+00:00",
"dateOfLastModification": "2024-10-30T00:00:00+00:00",
"categories": [
"Quantum Chemistry"
],
Expand Down
6 changes: 3 additions & 3 deletions demonstrations/tutorial_fermionic_operators.py
PietropaoloFrisoni marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@

fermi_word = a0_dag * a1
fermi_sentence = 1.3 * a0_dag * a1 + 2.4 * a1
fermi_sentence
print(fermi_sentence)

##############################################################################
# In this simple example, we first created the operator :math:`a^{\dagger}_0 a_1` and then created
# the linear combination :math:`1.3 a^{\dagger}_0 a_1 + 2.4 a_1.` We can also perform
# arithmetic operations between Fermi words and Fermi sentences.

fermi_sentence = fermi_sentence * fermi_word + 2.3 * fermi_word
fermi_sentence
print(fermi_sentence)

##############################################################################
# Beyond multiplication, summation, and subtraction, we can exponentiate fermionic operators in
Expand All @@ -61,7 +61,7 @@
# in the same way that you would write down the operator on a piece of paper:

fermi_sentence = 1.2 * a0_dag + 0.5 * a1 - 2.3 * (a0_dag * a1) ** 2
fermi_sentence
print(fermi_sentence)

##############################################################################
# This Fermi sentence can be mapped to the qubit basis using the
Expand Down
2 changes: 1 addition & 1 deletion demonstrations/tutorial_optimal_control.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"dateOfPublication": "2023-08-08T00:00:00+00:00",
"dateOfLastModification": "2024-10-07T00:00:00+00:00",
"dateOfLastModification": "2024-10-30T00:00:00+00:00",
"categories": [
"Optimization",
"Quantum Computing",
Expand Down
4 changes: 2 additions & 2 deletions demonstrations/tutorial_optimal_control.py
dwierichs marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def profit(params):
# Initial parameters for the start and end times of the rectangles
times = [jnp.linspace(eps, T - eps, P * 2) for op in ops_param]
# All initial parameters: small alternating amplitudes and times
params = [jnp.hstack([[0.1 * (-1) ** i for i in range(P)], time]) for time in times]
params = [jnp.hstack([jnp.array([0.1 * (-1) ** i for i in range(P)]), time]) for time in times]

#############################################################################
# Now we are all set up to train the parameters of the pulse sequence to produce
Expand Down Expand Up @@ -679,7 +679,7 @@ def profit(params):
# produced plot.

times = [jnp.linspace(eps, T - eps, P * 2) for op in ops_param]
params = [jnp.hstack([[0.2 * (-1) ** i for i in range(P)], time]) for time in times]
params = [jnp.hstack([jnp.array([0.2 * (-1) ** i for i in range(P)]), time]) for time in times]

num_steps = 1200
learning_rate = -2e-3
Expand Down
Loading