Skip to content

Commit d0bb36d

Browse files
committed
rename field tlist as times, and times as times_states
1 parent 1603d71 commit d0bb36d

File tree

12 files changed

+76
-76
lines changed

12 files changed

+76
-76
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- Implement `EnrSpace` and corresponding functionality. ([#500])
1111
- Check for orthogonality breakdown in `Lanczos` solver for `spectrum`. ([#501])
12-
- Store both `tlist` and `times` in time evolution solutions. ([#506], [#504])
12+
- Store both `times` and `times_states` in time evolution solutions. ([#506], [#504])
1313
- Fix errors in `Julia v1.12`. ([#507])
1414

1515
## [v0.32.1]

docs/src/users_guide/time_evolution/sesolve.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ sol = sesolve(H, ψ0, tlist, e_ops = [sigmaz(), sigmay()])
5959
Here, we call [`sesolve`](@ref) directly instead of pre-defining [`sesolveProblem`](@ref) first (as shown previously).
6060

6161
```@example sesolve
62-
println(size(sol.tlist)) # time points corresponds to stored expectation values
63-
println(size(sol.times)) # time points corresponds to stored states
62+
println(size(sol.times)) # time points corresponds to stored expectation values
63+
println(size(sol.times_states)) # time points corresponds to stored states
6464
```
6565

6666
```@example sesolve
@@ -91,8 +91,8 @@ If the keyword argument `e_ops` is not specified (or given as an empty `Vector`)
9191
tlist = [0, 10]
9292
sol = sesolve(H, ψ0, tlist) # or specify: e_ops = []
9393
94-
println(size(sol.tlist))
9594
println(size(sol.times))
95+
println(size(sol.times_states))
9696
9797
sol.states
9898
```
@@ -107,11 +107,11 @@ sol = sesolve(H, ψ0, tlist, e_ops = [sigmay()], saveat = tlist)
107107
```
108108

109109
```@example sesolve
110-
println(size(sol.tlist))
110+
println(size(sol.times))
111111
sol.expect
112112
```
113113

114114
```@example sesolve
115-
println(size(sol.times))
115+
println(size(sol.times_states))
116116
sol.states
117117
```

docs/src/users_guide/time_evolution/solution.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ CairoMakie.enable_only_mime!(MIME"image/svg+xml"())
1212

1313
| **Fields (Attributes)** | **Description** |
1414
|:------------------------|:----------------|
15-
| `sol.times` | The list of time points at which the states are stored during the evolution. |
16-
| `sol.tlist` | The list of time points at which the expectation values are calculated during the evolution. |
17-
| `sol.states` | The list of result states corresponding to each time point in `times`. |
18-
| `sol.expect` | The expectation values corresponding to each time point in `sol.tlist`. |
15+
| `sol.times` | The list of time points at which the expectation values are calculated during the evolution. |
16+
| `sol.times_states` | The list of time points at which the states are stored during the evolution. |
17+
| `sol.states` | The list of result states corresponding to each time point in `sol.times_states`. |
18+
| `sol.expect` | The expectation values corresponding to each time point in `sol.times`. |
1919
| `sol.alg` | The algorithm which is used during the solving process. |
2020
| `sol.abstol` | The absolute tolerance which is used during the solving process. |
2121
| `sol.reltol` | The relative tolerance which is used during the solving process. |
@@ -58,7 +58,7 @@ Recall that `Julia` uses `Fortran`-style indexing that begins with one (i.e., `[
5858
Together with the list of time points at which these expectation values are calculated:
5959

6060
```@example TE-solution
61-
tlist = sol.tlist
61+
times = sol.times
6262
nothing # hide
6363
```
6464

@@ -68,9 +68,9 @@ we can plot the resulting expectation values:
6868
# plot by CairoMakie.jl
6969
fig = Figure(size = (500, 350))
7070
ax = Axis(fig[1, 1], xlabel = L"t")
71-
lines!(ax, tlist, expt1, label = L"\langle 0 | \rho(t) | 0 \rangle")
72-
lines!(ax, tlist, expt2, label = L"\langle 1 | \rho(t) | 1 \rangle")
73-
lines!(ax, tlist, expt3, label = L"\langle 0 | \rho(t) | 1 \rangle")
71+
lines!(ax, times, expt1, label = L"\langle 0 | \rho(t) | 0 \rangle")
72+
lines!(ax, times, expt2, label = L"\langle 1 | \rho(t) | 1 \rangle")
73+
lines!(ax, times, expt3, label = L"\langle 0 | \rho(t) | 1 \rangle")
7474
7575
ylims!(ax, (-0.5, 1.0))
7676
axislegend(ax, position = :lb)
@@ -87,7 +87,7 @@ sol.states
8787
Together with the list of time points at which these states are stored:
8888

8989
```@example TE-solution
90-
times = sol.times
90+
times = sol.times_states
9191
nothing # hide
9292
```
9393

src/time_evolution/lr_mesolve.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ A structure storing the results and some information from solving low-rank maste
77
88
# Fields (Attributes)
99
10-
- `times::AbstractVector`: The list of time points at which the states are stored during the evolution.
11-
- `tlist::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
12-
- `states::Vector{QuantumObject}`: The list of result states corresponding to each time point in `times`.
13-
- `expect::Matrix`: The expectation values corresponding to each time point in `tlist`.
14-
- `fexpect::Matrix`: The function values corresponding to each time point in `tlist`.
10+
- `times::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
11+
- `times_states::AbstractVector`: The list of time points at which the states are stored during the evolution.
12+
- `states::Vector{QuantumObject}`: The list of result states corresponding to each time point in `times_states`.
13+
- `expect::Matrix`: The expectation values corresponding to each time point in `times`.
14+
- `fexpect::Matrix`: The function values corresponding to each time point in `times`.
1515
- `retcode`: The return code from the solver.
1616
- `alg`: The algorithm which is used during the solving process.
1717
- `abstol::Real`: The absolute tolerance which is used during the solving process.
@@ -32,7 +32,7 @@ struct TimeEvolutionLRSol{
3232
TM<:Vector{<:Integer},
3333
}
3434
times::TT1
35-
tlist::TT2
35+
times_states::TT2
3636
states::TS
3737
expect::TE
3838
fexpect::TE
@@ -147,19 +147,19 @@ function _periodicsave_func(integrator)
147147
return u_modified!(integrator, false)
148148
end
149149

150-
_save_control_lr_mesolve(u, t, integrator) = t in integrator.p.tlist
150+
_save_control_lr_mesolve(u, t, integrator) = t in integrator.p.times
151151

152152
function _save_affect_lr_mesolve!(integrator)
153153
ip = integrator.p
154154
N, M = ip.N, ip.M
155-
idx = select(integrator.t, ip.tlist)
155+
idx = select(integrator.t, ip.times)
156156

157157
@views z = reshape(integrator.u[1:(N*M)], N, M)
158158
@views B = reshape(integrator.u[(N*M+1):end], M, M)
159159
_calculate_expectation!(ip, z, B, idx)
160160

161161
if integrator.p.opt.progress
162-
print("\rProgress: $(round(Int, 100*idx/length(ip.tlist)))%")
162+
print("\rProgress: $(round(Int, 100*idx/length(ip.times)))%")
163163
flush(stdout)
164164
end
165165
return u_modified!(integrator, false)
@@ -433,7 +433,7 @@ function lr_mesolveProblem(
433433
e_ops = e_ops,
434434
f_ops = f_ops,
435435
opt = opt,
436-
tlist = t_l,
436+
times = t_l,
437437
expvals = expvals,
438438
funvals = funvals,
439439
Ml = Ml,
@@ -540,7 +540,7 @@ function lr_mesolve(
540540
end
541541

542542
function lr_mesolve(prob::ODEProblem; kwargs...)
543-
sol = solve(prob, prob.p.opt.alg, tstops = prob.p.tlist)
543+
sol = solve(prob, prob.p.opt.alg, tstops = prob.p.times)
544544
prob.p.opt.progress && print("\n")
545545

546546
N = prob.p.N
@@ -552,8 +552,8 @@ function lr_mesolve(prob::ODEProblem; kwargs...)
552552
ρt = map(x -> Qobj(x[1] * x[2] * x[1]', type = Operator(), dims = prob.p.Hdims), zip(zt, Bt))
553553

554554
return TimeEvolutionLRSol(
555+
prob.p.times,
555556
sol.t,
556-
prob.p.tlist,
557557
ρt,
558558
prob.p.expvals,
559559
prob.p.funvals,

src/time_evolution/mcsolve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ function mcsolveEnsembleProblem(
254254

255255
ensemble_prob = TimeEvolutionProblem(
256256
EnsembleProblem(prob_mc.prob, prob_func = _prob_func, output_func = _output_func[1], safetycopy = false),
257-
prob_mc.tlist,
257+
prob_mc.times,
258258
prob_mc.dimensions,
259259
(progr = _output_func[2], channel = _output_func[3]),
260260
)
@@ -411,8 +411,8 @@ function mcsolve(
411411

412412
return TimeEvolutionMCSol(
413413
ntraj,
414+
ens_prob_mc.times,
414415
_sol_1.t,
415-
ens_prob_mc.tlist,
416416
states,
417417
expvals,
418418
expvals, # This is average_expect

src/time_evolution/mesolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ function mesolve(prob::TimeEvolutionProblem, alg::OrdinaryDiffEqAlgorithm = Tsit
205205
end
206206

207207
return TimeEvolutionSol(
208+
prob.times,
208209
sol.t,
209-
prob.tlist,
210210
ρt,
211211
_get_expvals(sol, SaveFuncMESolve),
212212
sol.retcode,

src/time_evolution/sesolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ function sesolve(prob::TimeEvolutionProblem, alg::OrdinaryDiffEqAlgorithm = Tsit
155155
ψt = map-> QuantumObject(ϕ, type = Ket(), dims = prob.dimensions), sol.u)
156156

157157
return TimeEvolutionSol(
158+
prob.times,
158159
sol.t,
159-
prob.tlist,
160160
ψt,
161161
_get_expvals(sol, SaveFuncSESolve),
162162
sol.retcode,

src/time_evolution/smesolve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function smesolveEnsembleProblem(
269269

270270
ensemble_prob = TimeEvolutionProblem(
271271
EnsembleProblem(prob_sme, prob_func = _prob_func, output_func = _output_func[1], safetycopy = true),
272-
prob_sme.tlist,
272+
prob_sme.times,
273273
prob_sme.dimensions,
274274
merge(prob_sme.kwargs, (progr = _output_func[2], channel = _output_func[3])),
275275
)
@@ -424,8 +424,8 @@ function smesolve(
424424

425425
return TimeEvolutionStochasticSol(
426426
ntraj,
427+
ens_prob.times,
427428
_sol_1.t,
428-
ens_prob.tlist,
429429
states,
430430
expvals,
431431
expvals, # This is average_expect

src/time_evolution/ssesolve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function ssesolveEnsembleProblem(
262262

263263
ensemble_prob = TimeEvolutionProblem(
264264
EnsembleProblem(prob_sme, prob_func = _prob_func, output_func = _output_func[1], safetycopy = true),
265-
prob_sme.tlist,
265+
prob_sme.times,
266266
prob_sme.dimensions,
267267
(progr = _output_func[2], channel = _output_func[3]),
268268
)
@@ -418,8 +418,8 @@ function ssesolve(
418418

419419
return TimeEvolutionStochasticSol(
420420
ntraj,
421+
ens_prob.times,
421422
_sol_1.t,
422-
ens_prob.tlist,
423423
states,
424424
expvals,
425425
expvals, # This is average_expect

src/time_evolution/time_evolution.jl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A Julia constructor for handling the `ODEProblem` of the time evolution of quant
1414
# Fields (Attributes)
1515
1616
- `prob::AbstractSciMLProblem`: The `ODEProblem` of the time evolution.
17-
- `tlist::AbstractVector`: The time list of the evolution.
17+
- `times::AbstractVector`: The time list of the evolution.
1818
- `dimensions::AbstractDimensions`: The dimensions of the Hilbert space.
1919
- `kwargs::KWT`: Generic keyword arguments.
2020
@@ -23,7 +23,7 @@ A Julia constructor for handling the `ODEProblem` of the time evolution of quant
2323
"""
2424
struct TimeEvolutionProblem{PT<:AbstractSciMLProblem,TT<:AbstractVector,DT<:AbstractDimensions,KWT}
2525
prob::PT
26-
tlist::TT
26+
times::TT
2727
dimensions::DT
2828
kwargs::KWT
2929
end
@@ -37,7 +37,7 @@ function Base.getproperty(prob::TimeEvolutionProblem, key::Symbol)
3737
end
3838
end
3939

40-
TimeEvolutionProblem(prob, tlist, dims) = TimeEvolutionProblem(prob, tlist, dims, nothing)
40+
TimeEvolutionProblem(prob, times, dims) = TimeEvolutionProblem(prob, times, dims, nothing)
4141

4242
@doc raw"""
4343
struct TimeEvolutionSol
@@ -46,10 +46,10 @@ A structure storing the results and some information from solving time evolution
4646
4747
# Fields (Attributes)
4848
49-
- `times::AbstractVector`: The list of time points at which the states are stored during the evolution.
50-
- `tlist::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
51-
- `states::Vector{QuantumObject}`: The list of result states corresponding to each time point in `times`.
52-
- `expect::Union{AbstractMatrix,Nothing}`: The expectation values corresponding to each time point in `tlist`.
49+
- `times::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
50+
- `times_states::AbstractVector`: The list of time points at which the states are stored during the evolution.
51+
- `states::Vector{QuantumObject}`: The list of result states corresponding to each time point in `times_states`.
52+
- `expect::Union{AbstractMatrix,Nothing}`: The expectation values corresponding to each time point in `times`.
5353
- `retcode`: The return code from the solver.
5454
- `alg`: The algorithm which is used during the solving process.
5555
- `abstol::Real`: The absolute tolerance which is used during the solving process.
@@ -66,7 +66,7 @@ struct TimeEvolutionSol{
6666
RT<:Real,
6767
}
6868
times::TT1
69-
tlist::TT2
69+
times_states::TT2
7070
states::TS
7171
expect::TE
7272
retcode::RETT
@@ -99,12 +99,12 @@ A structure storing the results and some information from solving quantum trajec
9999
# Fields (Attributes)
100100
101101
- `ntraj::Int`: Number of trajectories
102-
- `times::AbstractVector`: The list of time points at which the states are stored during the evolution.
103-
- `tlist::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
104-
- `states::Vector{Vector{QuantumObject}}`: The list of result states in each trajectory and each time point in `times`.
105-
- `expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `tlist`.
106-
- `average_expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `tlist`.
107-
- `runs_expect::Union{AbstractArray,Nothing}`: The expectation values corresponding to each trajectory and each time point in `tlist`
102+
- `times::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
103+
- `times_states::AbstractVector`: The list of time points at which the states are stored during the evolution.
104+
- `states::Vector{Vector{QuantumObject}}`: The list of result states in each trajectory and each time point in `times_states`.
105+
- `expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `times`.
106+
- `average_expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `times`.
107+
- `runs_expect::Union{AbstractArray,Nothing}`: The expectation values corresponding to each trajectory and each time point in `times`
108108
- `col_times::Vector{Vector{Real}}`: The time records of every quantum jump occurred in each trajectory.
109109
- `col_which::Vector{Vector{Int}}`: The indices of which collapse operator was responsible for each quantum jump in `col_times`.
110110
- `converged::Bool`: Whether the solution is converged or not.
@@ -126,7 +126,7 @@ struct TimeEvolutionMCSol{
126126
}
127127
ntraj::Int
128128
times::TT1
129-
tlist::TT2
129+
times_states::TT2
130130
states::TS
131131
expect::TE
132132
average_expect::TE # Currently just a synonym for `expect`
@@ -164,12 +164,12 @@ A structure storing the results and some information from solving trajectories o
164164
# Fields (Attributes)
165165
166166
- `ntraj::Int`: Number of trajectories
167-
- `times::AbstractVector`: The list of time points at which the states are stored during the evolution.
168-
- `tlist::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
169-
- `states::Vector{Vector{QuantumObject}}`: The list of result states in each trajectory and each time point in `times`.
170-
- `expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `tlist`.
171-
- `average_expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `tlist`.
172-
- `runs_expect::Union{AbstractArray,Nothing}`: The expectation values corresponding to each trajectory and each time point in `tlist`
167+
- `times::AbstractVector`: The list of time points at which the expectation values are calculated during the evolution.
168+
- `times_states::AbstractVector`: The list of time points at which the states are stored during the evolution.
169+
- `states::Vector{Vector{QuantumObject}}`: The list of result states in each trajectory and each time point in `times_states`.
170+
- `expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `times`.
171+
- `average_expect::Union{AbstractMatrix,Nothing}`: The expectation values (averaging all trajectories) corresponding to each time point in `times`.
172+
- `runs_expect::Union{AbstractArray,Nothing}`: The expectation values corresponding to each trajectory and each time point in `times`
173173
- `converged::Bool`: Whether the solution is converged or not.
174174
- `alg`: The algorithm which is used during the solving process.
175175
- `abstol::Real`: The absolute tolerance which is used during the solving process.
@@ -188,7 +188,7 @@ struct TimeEvolutionStochasticSol{
188188
}
189189
ntraj::Int
190190
times::TT1
191-
tlist::TT2
191+
times_states::TT2
192192
states::TS
193193
expect::TE
194194
average_expect::TE # Currently just a synonym for `expect`

0 commit comments

Comments
 (0)