@@ -18,7 +18,8 @@ using ..RandomObjects: random_matrix, random_state_vector
1818```julia
1919problem = dummy_control_problem(;
2020 N=10, n_objectives=1, n_controls=1, n_steps=50, dt=1.0, density=0.5,
21- complex_operators=true, hermitian=true, rng, kwargs...)
21+ complex_operators=true, hermitian=true, pulses_as_controls=false, rng,
22+ kwargs...)
2223```
2324
2425Sets up a control problem with random (sparse) Hermitian matrices.
@@ -39,6 +40,9 @@ Sets up a control problem with random (sparse) Hermitian matrices.
3940 complex-valued or real-valued.
4041* `hermitian`: Whether or not all drift/control operators will be Hermitian
4142 matrices.
43+ * `pulses_as_controls=false`: If true, directly use pulses (discretized to the
44+ midpoints of the time grid) as controls, instead of the normal controls
45+ discretized to the points of the time grid.
4246* `rng=Random.GLOBAL_RNG`: The random number generator to use. See
4347 [`random_matrix`](@ref) and [`random_state_vector`](@ref).
4448* `kwargs`: All other keyword arguments are passed on to
@@ -53,6 +57,7 @@ function dummy_control_problem(;
5357 density= 0.5 ,
5458 complex_operators= true ,
5559 hermitian= true ,
60+ pulses_as_controls= false ,
5661 rng= Random. GLOBAL_RNG,
5762 kwargs...
5863)
@@ -63,7 +68,11 @@ function dummy_control_problem(;
6368 # we normalize on the *intervals*, not on the time grid points
6469 pulses[l] ./= norm (pulses[l])
6570 end
66- controls = [discretize (pulse, tlist) for pulse in pulses]
71+ if pulses_as_controls
72+ controls = pulses
73+ else
74+ controls = [discretize (pulse, tlist) for pulse in pulses]
75+ end
6776
6877 hamiltonian = []
6978 H_0 = random_matrix (N; rng, density, hermitian, complex= complex_operators)
0 commit comments