@@ -17,14 +17,14 @@ function qubit_lvn(eps)
1717
1818 H0 = 1 / 2 * sigma_z
1919
20- return liouvillian ((H0, (sigma_x, eps[1 ])); convention= :TDSE )
20+ return liouvillian ((H0, (sigma_x, eps[1 ])); convention = :TDSE )
2121end
2222
2323@testset " GRAPE ExponentialUtilities Liouvillian" begin
2424 # Pulse Parameters (Same as unitary)
2525 tf = 20 ns
2626 Nsteps = 100
27- tgrid = collect (range (0 , tf; length= Nsteps + 1 ))
27+ tgrid = collect (range (0 , tf; length = Nsteps + 1 ))
2828
2929 # Target gate on the qubit subspace (embed 2×2 into 3×3)
3030 U_tgt = ComplexF64[0 1 ; 1 0 ]
3838 basis_tgt = [U_tgt * b * U_tgt' for b in basis]
3939
4040 eps = [
41- 0.2 * (1 + 0.05 * rand ()) *
42- QuantumControl. Shapes. flattop .(tgrid, T= tf, t_rise= 0.3 , func= :blackman )
43- for _ in 1 : 2
41+ 0.2 *
42+ (1 + 0.05 * rand ()) *
43+ QuantumControl. Shapes. flattop .(tgrid, T = tf, t_rise = 0.3 , func = :blackman )
44+ for _ = 1 : 2
4445 ]
4546
4647 lvn = qubit_lvn (eps)
4748
4849 trajectories = [
4950 Trajectory (
50- initial_state= reshape (basis[i], :),
51- generator= lvn,
52- target_state= reshape (basis_tgt[i], :)
51+ initial_state = reshape (basis[i], :),
52+ generator = lvn,
53+ target_state = reshape (basis_tgt[i], :)
5354 ) for i in eachindex (basis)
5455 ]
5556
5657 problem = ControlProblem (
57- trajectories= trajectories,
58- tlist= tgrid,
59- iter_stop= 10 ,
60- prop_method= :expv ,
61- gradient_method= :taylor ,
62- prop_expv_kwargs= (; ishermitian= false ),
63- J_T= QuantumControl. Functionals. J_T_re
58+ trajectories = trajectories,
59+ tlist = tgrid,
60+ iter_stop = 10 ,
61+ prop_method = :expv ,
62+ gradient_method = :taylor ,
63+ prop_expv_kwargs = (; ishermitian = false ),
64+ J_T = QuantumControl. Functionals. J_T_re
6465 )
6566
6667 println (" Starting optimization with QuantumPropagators: ExponentialUtilities..." )
67- result = QuantumControl. optimize (problem; method= GRAPE, print_iters= true )
68+ result = QuantumControl. optimize (problem; method = GRAPE, print_iters = true )
6869 display (result)
6970
7071 @test isfinite (result. J_T)
7374@testset " GRAPE ExponentialUtilities Gradgen Error" begin
7475 tf = 1.0
7576 Nsteps = 10
76- tgrid = collect (range (0 , tf; length= Nsteps + 1 ))
77+ tgrid = collect (range (0 , tf; length = Nsteps + 1 ))
7778
7879 basis = Matrix{ComplexF64}[]
7980 push! (basis, [1 0 ; 0 0 ])
8485 U_tgt = ComplexF64[0 1 ; 1 0 ]
8586 basis_tgt = [U_tgt * b * U_tgt' for b in basis]
8687
87- eps = [0.2 * QuantumControl. Shapes. flattop .(tgrid, T= tf, t_rise= 0.3 ) for _ in 1 : 2 ]
88+ eps = [0.2 * QuantumControl. Shapes. flattop .(tgrid, T = tf, t_rise = 0.3 ) for _ = 1 : 2 ]
8889 lvn = qubit_lvn (eps)
8990
9091 trajectories = [
9192 Trajectory (
92- initial_state= reshape (basis[i], :),
93- generator= lvn,
94- target_state= reshape (basis_tgt[i], :),
93+ initial_state = reshape (basis[i], :),
94+ generator = lvn,
95+ target_state = reshape (basis_tgt[i], :),
9596 ) for i in eachindex (basis)
9697 ]
9798
9899 problem = ControlProblem (
99- trajectories= trajectories,
100- tlist= tgrid,
101- iter_stop= 1 ,
102- prop_method= :expv ,
103- prop_expv_kwargs= (; ishermitian= false ),
104- grad_prop_method= :expv ,
105- gradient_method= :gradgen ,
106- J_T= QuantumControl. Functionals. J_T_re
100+ trajectories = trajectories,
101+ tlist = tgrid,
102+ iter_stop = 1 ,
103+ prop_method = :expv ,
104+ prop_expv_kwargs = (; ishermitian = false ),
105+ grad_prop_method = :expv ,
106+ gradient_method = :gradgen ,
107+ J_T = QuantumControl. Functionals. J_T_re
107108 )
108109
109- res = QuantumControl. optimize (problem; method= GRAPE, print_iters= false )
110+ res = QuantumControl. optimize (problem; method = GRAPE, print_iters = false )
110111 @test occursin (" gradient_method=:gradgen" , res. message)
111112end
0 commit comments