Skip to content

Commit 052f530

Browse files
Format Document
1 parent 25aeba5 commit 052f530

File tree

1 file changed

+52
-14
lines changed

1 file changed

+52
-14
lines changed

test/core-test/time_evolution.jl

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
sol_string = sprint((t, s) -> show(t, "text/plain", s), sol)
2929

3030
## Analytical solution for the expectation value of a' * a
31-
Ω_rabi = sqrt(g^2 + ((ωc - ωq)/2)^2)
31+
Ω_rabi = sqrt(g^2 + ((ωc - ωq) / 2)^2)
3232
amp_rabi = g^2 / Ω_rabi^2
3333
##
3434

@@ -171,14 +171,14 @@
171171

172172
# Time-Dependent Hamiltonian
173173
# ssesolve is slow to be run on CI. It is not removed from the test because it may be useful for testing in more powerful machines.
174-
174+
175175
ωd = 1.02
176176
F = 0.05
177-
177+
178178
# Time Evolution in the drive frame
179179

180180
H_dr_fr = H - ωd * a' * a - ωd * σz / 2 + F * (a + a')
181-
181+
182182
rng = MersenneTwister(12)
183183

184184
tlist = range(0, 10 / γ, 1000)
@@ -257,29 +257,67 @@
257257
allocs_tot = @allocations mesolve(L_td, ψ0, tlist, e_ops = e_ops, progress_bar = Val(false), params = p)
258258
@test allocs_tot < 210
259259

260-
allocs_tot = @allocations mesolve(L_td, ψ0, tlist, progress_bar = Val(false), saveat = [tlist[end]], params = p) # Warm-up
261-
allocs_tot = @allocations mesolve(L_td, ψ0, tlist, progress_bar = Val(false), saveat = [tlist[end]], params = p)
260+
allocs_tot =
261+
@allocations mesolve(L_td, ψ0, tlist, progress_bar = Val(false), saveat = [tlist[end]], params = p) # Warm-up
262+
allocs_tot =
263+
@allocations mesolve(L_td, ψ0, tlist, progress_bar = Val(false), saveat = [tlist[end]], params = p)
262264
@test allocs_tot < 120
263265
end
264266

265267
@testset "Memory Allocations (mcsolve)" begin
266268
ntraj = 100
267-
allocs_tot = @allocations mcsolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj=ntraj, progress_bar = Val(false)) # Warm-up
268-
allocs_tot = @allocations mcsolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj=ntraj, progress_bar = Val(false))
269+
allocs_tot =
270+
@allocations mcsolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj = ntraj, progress_bar = Val(false)) # Warm-up
271+
allocs_tot =
272+
@allocations mcsolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj = ntraj, progress_bar = Val(false))
269273
@test allocs_tot < 160 * ntraj + 500 # 150 allocations per trajectory + 500 for initialization
270274

271-
allocs_tot = @allocations mcsolve(H, ψ0, tlist, c_ops, ntraj=ntraj, saveat = [tlist[end]], progress_bar = Val(false)) # Warm-up
272-
allocs_tot = @allocations mcsolve(H, ψ0, tlist, c_ops, ntraj=ntraj, saveat = [tlist[end]], progress_bar = Val(false))
275+
allocs_tot = @allocations mcsolve(
276+
H,
277+
ψ0,
278+
tlist,
279+
c_ops,
280+
ntraj = ntraj,
281+
saveat = [tlist[end]],
282+
progress_bar = Val(false),
283+
) # Warm-up
284+
allocs_tot = @allocations mcsolve(
285+
H,
286+
ψ0,
287+
tlist,
288+
c_ops,
289+
ntraj = ntraj,
290+
saveat = [tlist[end]],
291+
progress_bar = Val(false),
292+
)
273293
@test allocs_tot < 160 * ntraj + 300 # 100 allocations per trajectory + 300 for initialization
274294
end
275295

276296
@testset "Memory Allocations (ssesolve)" begin
277-
allocs_tot = @allocations ssesolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj=100, progress_bar = Val(false)) # Warm-up
278-
allocs_tot = @allocations ssesolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj=100, progress_bar = Val(false))
297+
allocs_tot =
298+
@allocations ssesolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj = 100, progress_bar = Val(false)) # Warm-up
299+
allocs_tot =
300+
@allocations ssesolve(H, ψ0, tlist, c_ops, e_ops = e_ops, ntraj = 100, progress_bar = Val(false))
279301
@test allocs_tot < 1950000 # TODO: Fix this high number of allocations
280302

281-
allocs_tot = @allocations ssesolve(H, ψ0, tlist, c_ops, ntraj=100, saveat = [tlist[end]], progress_bar = Val(false)) # Warm-up
282-
allocs_tot = @allocations ssesolve(H, ψ0, tlist, c_ops, ntraj=100, saveat = [tlist[end]], progress_bar = Val(false))
303+
allocs_tot = @allocations ssesolve(
304+
H,
305+
ψ0,
306+
tlist,
307+
c_ops,
308+
ntraj = 100,
309+
saveat = [tlist[end]],
310+
progress_bar = Val(false),
311+
) # Warm-up
312+
allocs_tot = @allocations ssesolve(
313+
H,
314+
ψ0,
315+
tlist,
316+
c_ops,
317+
ntraj = 100,
318+
saveat = [tlist[end]],
319+
progress_bar = Val(false),
320+
)
283321
@test allocs_tot < 570000 # TODO: Fix this high number of allocations
284322
end
285323

0 commit comments

Comments
 (0)