Skip to content

Commit 38c09a7

Browse files
committed
revise
1 parent d554290 commit 38c09a7

File tree

5 files changed

+84
-7
lines changed

5 files changed

+84
-7
lines changed

src/algorithm/AD.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#### control optimization ####
2+
"""
3+
Control optimization with autoGRAPE.
4+
5+
"""
26
function update!(opt::ControlOpt, alg::AbstractautoGRAPE, obj, dynamics, output)
37
(; max_episode) = alg
48
ctrl_length = length(dynamics.data.ctrl[1])
@@ -43,6 +47,10 @@ function update_ctrl!(alg::autoGRAPE, obj, dynamics, δ)
4347
end
4448

4549
#### state optimization ####
50+
"""
51+
State optimization with AD.
52+
53+
"""
4654
function update!(opt::StateOpt, alg::AbstractAD, obj, dynamics, output)
4755
(; max_episode) = alg
4856
f_ini, f_comp = objective(obj, dynamics)
@@ -76,6 +84,10 @@ function update_state!(alg::AD, obj, dynamics, δ)
7684
end
7785

7886
#### find the optimal linear combination of a given set of POVM ####
87+
"""
88+
Measurement optimization (method: linear combination) with AD.
89+
90+
"""
7991
function update!(opt::Mopt_LinearComb, alg::AbstractAD, obj, dynamics, output)
8092
(; max_episode) = alg
8193
(; POVM_basis, M_num) = opt
@@ -123,6 +135,10 @@ function update_M!(opt::Mopt_LinearComb, alg::AD, obj, δ)
123135
end
124136

125137
#### find the optimal rotated measurement of a given set of POVM ####
138+
"""
139+
Measurement optimization (method: rotation) with AD.
140+
141+
"""
126142
function update!(opt::Mopt_Rotation, alg::AbstractAD, obj, dynamics, output)
127143
(; max_episode) = alg
128144
(; POVM_basis) = opt
@@ -180,6 +196,10 @@ function update_M!(opt::Mopt_Rotation, alg::AD, obj, δ)
180196
end
181197

182198
#### state abd control optimization ####
199+
"""
200+
Comprehensive optimization on state and control with AD.
201+
202+
"""
183203
function update!(opt::StateControlOpt, alg::AbstractAD, obj, dynamics, output)
184204
(; max_episode) = alg
185205
ctrl_length = length(dynamics.data.ctrl[1])

src/algorithm/DDPG.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ mutable struct ControlEnv <: AbstractEnv
4141
end
4242

4343
#### control optimization ####
44+
"""
45+
Control optimization with DDPG.
46+
47+
"""
4448
function update!(opt::ControlOpt, alg::DDPG, obj, dynamics, output)
4549
(; max_episode, layer_num, layer_dim, rng) = alg
4650
#### environment of DDPG ####
@@ -243,6 +247,10 @@ RLBase.reward(env::StateEnv) = env.reward
243247
RLBase.is_terminated(env::StateEnv) = env.done
244248
RLBase.state(env::StateEnv) = env.state
245249

250+
"""
251+
State optimization with DDPG.
252+
253+
"""
246254
function update!(Sopt::StateOpt, alg::DDPG, obj, dynamics::Lindblad, output)
247255
(; max_episode, layer_num, layer_dim, rng) = alg
248256
episode = 1

src/algorithm/DE.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#### control optimization ####
2+
"""
3+
Control optimization with DE.
4+
5+
"""
26
function update!(opt::ControlOpt, alg::DE, obj, dynamics, output)
37
(; max_episode, p_num, ini_population, c, cr, rng) = alg
48
if ismissing(ini_population)
@@ -77,6 +81,10 @@ function update!(opt::ControlOpt, alg::DE, obj, dynamics, output)
7781
end
7882

7983
#### state optimization ####
84+
"""
85+
State optimization with DE.
86+
87+
"""
8088
function update!(opt::StateOpt, alg::DE, obj, dynamics, output)
8189
(; max_episode, p_num, ini_population, c, cr, rng) = alg
8290
if ismissing(ini_population)
@@ -140,6 +148,10 @@ function update!(opt::StateOpt, alg::DE, obj, dynamics, output)
140148
end
141149

142150
#### projective measurement optimization ####
151+
"""
152+
Measurement optimization (method: projection) with DE.
153+
154+
"""
143155
function update!(opt::Mopt_Projection, alg::DE, obj, dynamics, output)
144156
(; max_episode, p_num, ini_population, c, cr, rng) = alg
145157
if ismissing(ini_population)
@@ -222,6 +234,10 @@ function update!(opt::Mopt_Projection, alg::DE, obj, dynamics, output)
222234
end
223235

224236
#### find the optimal linear combination of a given set of POVM ####
237+
"""
238+
Measurement optimization (method: linear combination) with DE.
239+
240+
"""
225241
function update!(opt::Mopt_LinearComb, alg::DE, obj, dynamics, output)
226242
(; max_episode, p_num, ini_population, c, cr, rng) = alg
227243
(; B, POVM_basis, M_num) = opt
@@ -305,6 +321,10 @@ function update!(opt::Mopt_LinearComb, alg::DE, obj, dynamics, output)
305321
end
306322

307323
#### find the optimal rotated measurement of a given set of POVM ####
324+
"""
325+
Measurement optimization (method: rotation) with DE.
326+
327+
"""
308328
function update!(opt::Mopt_Rotation, alg::DE, obj, dynamics, output)
309329
(; max_episode, p_num, ini_population, c, cr, rng) = alg
310330
(; s, POVM_basis, Lambda) = opt
@@ -398,6 +418,10 @@ function update!(opt::Mopt_Rotation, alg::DE, obj, dynamics, output)
398418
end
399419

400420
#### state and control optimization ####
421+
"""
422+
Comprehensive optimization on state and control with DE.
423+
424+
"""
401425
function update!(opt::StateControlOpt, alg::DE, obj, dynamics, output)
402426
(; max_episode, p_num, ini_population, c, cr, rng) = alg
403427
if ismissing(ini_population)
@@ -497,6 +521,10 @@ function update!(opt::StateControlOpt, alg::DE, obj, dynamics, output)
497521
end
498522

499523
#### state and measurement optimization ####
524+
"""
525+
Comprehensive optimization on state and measurement with DE.
526+
527+
"""
500528
function update!(opt::StateMeasurementOpt, alg::DE, obj, dynamics, output)
501529
(; max_episode, p_num, ini_population, c, cr, rng) = alg
502530
if ismissing(ini_population)
@@ -600,6 +628,10 @@ function update!(opt::StateMeasurementOpt, alg::DE, obj, dynamics, output)
600628
end
601629

602630
#### control and measurement optimization ####
631+
"""
632+
Comprehensive optimization on control and measurement with DE.
633+
634+
"""
603635
function update!(opt::ControlMeasurementOpt, alg::DE, obj, dynamics, output)
604636
(; max_episode, p_num, ini_population, c, cr, rng) = alg
605637
if ismissing(ini_population)
@@ -714,6 +746,10 @@ function update!(opt::ControlMeasurementOpt, alg::DE, obj, dynamics, output)
714746
end
715747

716748
#### state, control and measurement optimization ####
749+
"""
750+
Comprehensive optimization on state, control and measurement with DE.
751+
752+
"""
717753
function update!(opt::StateControlMeasurementOpt, alg::DE, obj, dynamics, output)
718754
(; max_episode, p_num, ini_population, c, cr, rng) = alg
719755
if ismissing(ini_population)

src/algorithm/GRAPE.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""
2+
update!(opt::ControlOpt, alg::AbstractGRAPE, obj::QFIM_obj, dynamics, output)
3+
4+
Control optimization with GRAPE, where the objective is QFIM.
5+
6+
"""
17
function update!(opt::ControlOpt, alg::AbstractGRAPE, obj::QFIM_obj, dynamics, output)
28
(; max_episode) = alg
39
ctrl_length = length(dynamics.data.ctrl[1])
@@ -22,6 +28,10 @@ function update!(opt::ControlOpt, alg::AbstractGRAPE, obj::QFIM_obj, dynamics, o
2228
set_io!(output, output.f_list[end])
2329
end
2430

31+
"""
32+
Control optimization with GRAPE, where the objective is CFIM.
33+
34+
"""
2535
function update!(opt::ControlOpt, alg::AbstractGRAPE, obj::CFIM_obj, dynamics, output)
2636
(; max_episode) = alg
2737
ctrl_length = length(dynamics.data.ctrl[1])

src/objective/AsymptoticBound/CramerRao.jl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const σ_z = [1.0 0.0im; 0.0 -1.0]
66
############## logarrithmic derivative ###############
77
@doc raw"""
88
9-
SLD(ρ::Matrix{T}, dρ::Vector{Matrix{T}}; rep = "original", eps = GLOBAL_EPS) where {T<:Complex}
9+
SLD(ρ::Matrix{T}, dρ::Vector{Matrix{T}}; rep = "original", eps = GLOBAL_EPS) Complex}
1010
1111
Calculate the symmetric logarrithmic derivatives (SLDs).The SLD operator $L_a$ is defined as``\partial_{a}\rho=\frac{1}{2}(\rho L_{a}+L_{a}\rho)``, where ρ is the parameterized density matrix.
1212
@@ -94,7 +94,7 @@ end
9494

9595
@doc raw"""
9696
97-
RLD(ρ::Matrix{T}, dρ::Vector{Matrix{T}}; rep = "original", eps = GLOBAL_EPS) where {T<:Complex}
97+
RLD(ρ::Matrix{T}, dρ::Vector{Matrix{T}}; rep = "original", eps = GLOBAL_EPS) where {T<:Complex}
9898
9999
Calculate the right logarrithmic derivatives (RLDs). The RLD operator is defined as ``\partial_{a}\rho=\rho \mathcal{R}_a``, where ρ is the parameterized density matrix.
100100
@@ -156,14 +156,14 @@ end
156156

157157
@doc raw"""
158158
159-
LLD(ρ::Matrix{T}, dρ::Vector{Matrix{T}}; rep = "original", eps = GLOBAL_EPS) where {T<:Complex}
159+
LLD(ρ::Matrix{T}, dρ::Vector{Matrix{T}}; rep = "original", eps = GLOBAL_EPS) where {T<:Complex}
160160
161161
Calculate the left logarrithmic derivatives (LLDs). The LLD operator is defined as ``\partial_{a}\rho=\mathcal{R}_a^{\dagger}\rho``, where ρ is the parameterized density matrix.
162162
- `ρ`: Density matrix.
163163
- `dρ`: Derivatives of the density matrix with respect to the unknown parameters to be estimated. For example, drho[1] is the derivative vector with respect to the first parameter.
164164
- `rep`: Representation of the LLD operator. Options can be:
165-
- "original" (default) -- The RLD matrix will be written in terms of the same basis as the input density matrix (ρ).
166-
- "eigen" -- The RLD matrix will be written in terms of the eigenbasis of the input ρ.
165+
- "original" (default) -- The RLD matrix will be written in terms of the same basis as the input density matrix (ρ).
166+
- "eigen" -- The RLD matrix will be written in terms of the eigenbasis of the input ρ.
167167
- `eps`: Machine epsilon
168168
169169
"""
@@ -563,11 +563,14 @@ Calculate the SLD based quantum Fisher information matrix (QFIM) with gaussian s
563563
564564
- `R̄` : First-order moment.
565565
566-
- `dR̄`: Derivatives of the first-order moment with respect to the unknown parameters to be estimated. For example, dR[1] is the derivative vector on the first parameter.
566+
- `dR̄`: Derivatives of the first-order moment with respect to the unknown parameters to be
567+
estimated. For example, dR[1] is the derivative vector on the first
568+
parameter.
567569
568570
- `D`: Second-order moment.
569571
570-
- `dD`: Derivatives of the second-order moment with respect to the unknown parameters to be estimated.
572+
- `dD`: Derivatives of the second-order moment with respect to the unknown parameters to be
573+
estimated.
571574
572575
- `eps`: Machine epsilon
573576

0 commit comments

Comments
 (0)