Skip to content

Commit

Permalink
Adapt to in-place interface
Browse files Browse the repository at this point in the history
Test optimization with static arrays
  • Loading branch information
goerz committed Jul 26, 2024
1 parent a8ddddf commit e4b8729
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/optimize.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using QuantumControlBase.QuantumPropagators.Generators: Operator
using QuantumControlBase.QuantumPropagators.Controls: discretize, evaluate
using QuantumControlBase.QuantumPropagators.Interfaces: supports_inplace
using QuantumControlBase.QuantumPropagators: prop_step!, reinit_prop!, propagate
using QuantumControlBase.QuantumPropagators.Storage:
write_to_storage!, get_from_storage!, get_from_storage
Expand Down Expand Up @@ -282,7 +283,7 @@ function krotov_iteration(wrk, ϵ⁽ⁱ⁾, ϵ⁽ⁱ⁺¹⁾)
for n = 1:N_T # `n` is the index for the time interval
dt = tlist[n+1] - tlist[n]
for k = 1:N
if ismutable(χ[k])
if supports_inplace(χ[k])
get_from_storage!(χ[k], X[k], n)
else
χ[k] = get_from_storage(X[k], n)
Expand Down
4 changes: 3 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
GRAPE = "6b52fcaf-80fe-489a-93e9-9f92080510be"
IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
Krotov = "b05dcdc7-62f6-4360-bf2c-0898bba419de"
Expand All @@ -26,11 +27,12 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Term = "22787eb5-b846-44ae-b979-8e399b8463ab"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TwoQubitWeylChamber = "cad078a0-0012-46f4-b55e-a945d44e115b"
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"

[compat]
Documenter = "1.1"
julia = "1.6"
julia = "1.9"
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ unicodeplots()
# Note: comment outer @testset to stop after first @safetestset failure
@time @testset verbose = true "Krotov.jl Package" begin

println("\n* TLS Optimization (test_tls_optimization.jl)")
@time @safetestset "TLS Optimization" begin
include("test_tls_optimization.jl")
end

println("\n* Pulse Optimization (test_pulse_optimization.jl)")
@time @safetestset "Pulse Optimization" begin
include("test_pulse_optimization.jl")
Expand Down

0 comments on commit e4b8729

Please sign in to comment.