Skip to content

Commit

Permalink
Merge pull request #18 from aarontrowbridge/dev-aaron
Browse files Browse the repository at this point in the history
Dev aaron
  • Loading branch information
aarontrowbridge committed May 19, 2023
2 parents 6adb3ee + 1948417 commit 5947ed2
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuantumCollocation"
uuid = "0dc23a59-5ffb-49af-b6bd-932a8ae77adf"
authors = ["Aaron Trowbridge <[email protected]> and contributors"]
version = "0.1.2"
version = "0.1.3"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Expand Down
61 changes: 61 additions & 0 deletions examples/cavity/binomial_code.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using QuantumCollocation
using NamedTrajectories

transmon_levels = 3
cavity_levels = 14

system = MultiModeSystem(transmon_levels, cavity_levels)

g0 = multimode_state("g0", transmon_levels, cavity_levels)
e0 = multimode_state("e0", transmon_levels, cavity_levels)

g1 = multimode_state("g1", transmon_levels, cavity_levels)
g2 = multimode_state("g1", transmon_levels, cavity_levels)
g4 = multimode_state("g4", transmon_levels, cavity_levels)

ψ_init = [g0, e0]
ψ_goal = [(g0 + g4) / 2, g2]

qubit_a_bound = 0.153
cavity_a_bound = 0.193

dda_bound = 1e-4

a_bounds = [qubit_a_bound, qubit_a_bound, cavity_a_bound, cavity_a_bound]

T = 200
Δt = 10.0
Δt_max = Δt
Δt_min = 0.2Δt
Q = 200.0
R_L1 = 1.0
max_iter = 2000
cavity_forbidden_states = cavity_levels .* [1, 2, 3, 4]
transmon_forbidden_states = 2 * (transmon_levels - 1) * cavity_levels + 1 : 2 * transmon_levels * cavity_levels

forbidden_states = [transmon_forbidden_states; cavity_forbidden_states]

prob = QuantumStateSmoothPulseProblem(system, ψ_init, ψ_goal, T, Δt;
Δt_max=Δt_max,
Δt_min=Δt_min,
dda_bound=dda_bound,
a_bounds=a_bounds,
L1_regularized_names=[:ψ̃1, :ψ̃2],
L1_regularized_indices=(ψ̃1 = forbidden_states, ψ̃2 = forbidden_states),
Q=Q,
R_L1=R_L1,
)

experiment = "T_$(T)_dt_$(Δt)_Q_$(Q)_R_L1_$(R_L1)_max_iter_$(max_iter)_dda_bound_$(dda_bound)"

plot_dir = joinpath(@__DIR__, "plots/binomial_code")
save_dir = joinpath(@__DIR__, "data/binomial_code")

plot_path = generate_file_path("png", experiment, plot_dir)
save_path = generate_file_path("jld2", experiment, save_dir)

plot(plot_path, prob.trajectory, [:ψ̃1, :ψ̃2, :a]; ignored_labels=[:ψ̃1, :ψ̃2])

solve!(prob; max_iter=max_iter, save_path=save_path)

plot(plot_path, prob.trajectory, [:ψ̃1, :ψ̃2, :a]; ignored_labels=[:ψ̃1, :ψ̃2])
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/three_qubit_swap/cold_start.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Q = 200.0
a_bound = 2π * 0.04 # GHz, a guess!
dda_bound = 0.05

duration = 200.0
duration = 200.0 # ns
T = 500
Δt = duration / T
Δt_min = 0.5 * Δt
Expand Down
88 changes: 55 additions & 33 deletions examples/three_qubit_swap/figures_makie.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion images/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/continuous_trajectories.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ end
function cubic_spline_coeffs(aᵢ, ȧᵢ, aᵢ₊₁, ȧᵢ₊₁, tᵢ, tᵢ₊₁)
M = [
1 tᵢ tᵢ^2 tᵢ^3 ;
0 1 2tᵢ 3tᵢ^2 ;
0 1 2tᵢ 3tᵢ^2 ;
1 tᵢ₊₁ tᵢ₊₁^2 tᵢ₊₁^3 ;
0 1 2tᵢ₊₁ 3tᵢ₊₁^2
0 1 2tᵢ₊₁ 3tᵢ₊₁^2
]
A = vcat(transpose.([aᵢ, ȧᵢ, aᵢ₊₁, ȧᵢ₊₁])...)
B = inv(M) * A
Expand Down
2 changes: 1 addition & 1 deletion src/save_load_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function save_problem(
save(path, data)
end

const RESERVED_KEYS = ["system", "trajectory", "options", "params"]
const RESERVED_KEYS = ["system", "trajectory", "options", "params", "integrators"]

function load_problem(path::String; verbose=true, return_data=false)
data = load(path)
Expand Down

2 comments on commit 5947ed2

@aarontrowbridge
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/83895

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.3 -m "<description of version>" 5947ed231404f3560d47b72c97d39fe7c6eeae28
git push origin v0.1.3

Please sign in to comment.