@@ -110,9 +110,14 @@ A structure storing the results and some information from solving quantum trajec
110110- `abstol::Real`: The absolute tolerance which is used during the solving process.
111111- `reltol::Real`: The relative tolerance which is used during the solving process.
112112
113- # Methods
113+ # Notes
114114
115- We also provide the following functions for analyzing statistics from multi-trajectory solutions.
115+ The index-order of the elements in fields `states` and `expect` are:
116+
117+ - `sol.states[trajectory][time]`
118+ - `sol.expect[e_op,trajectory,time]`
119+
120+ We also provide the following functions for statistical analysis of multi-trajectory solutions.
116121
117122- [`average_states`](@ref)
118123- [`average_expect`](@ref)
@@ -173,9 +178,14 @@ A structure storing the results and some information from solving trajectories o
173178- `abstol::Real`: The absolute tolerance which is used during the solving process.
174179- `reltol::Real`: The relative tolerance which is used during the solving process.
175180
176- # Methods
181+ # Notes
182+
183+ The index-order of the elements in fields `states` and `expect` are:
177184
178- We also provide the following functions for analyzing statistics from multi-trajectory solutions.
185+ - `sol.states[trajectory][time]`
186+ - `sol.expect[e_op,trajectory,time]`
187+
188+ We also provide the following functions for statistical analysis of multi-trajectory solutions.
179189
180190- [`average_states`](@ref)
181191- [`average_expect`](@ref)
@@ -221,24 +231,33 @@ end
221231@doc raw """
222232 average_states(sol::TimeEvolutionMultiTrajSol)
223233
224- Return the trajectory-averaged result states at each time point.
234+ Return the trajectory-averaged result states (as density [`Operator`](@ref)) at each time point.
225235"""
226- average_states (sol:: TimeEvolutionMultiTrajSol ) = mean (sol. states)
236+ average_states (sol:: TimeEvolutionMultiTrajSol ) = mean (ket2dm, sol. states)
227237
228238@doc raw """
229239 average_expect(sol::TimeEvolutionMultiTrajSol)
230240
231241Return the trajectory-averaged expectation values at each time point.
232242"""
233- average_expect (sol:: TimeEvolutionMultiTrajSol{TE} ) where {TE<: AbstractArray } = dropdims (mean (sol. runs_expect, dims = 2 ), dims = 2 )
243+ average_expect (sol:: TimeEvolutionMultiTrajSol{TE} ) where {TE<: AbstractArray } =
244+ dropdims (mean (sol. expect, dims = 2 ), dims = 2 )
234245average_expect (sol:: TimeEvolutionMultiTrajSol{Nothing} ) = nothing
235246
236247@doc raw """
237248 std_expect(sol::TimeEvolutionMultiTrajSol)
238249
239250Return the trajectory-wise standard deviation of the expectation values at each time point.
240251"""
241- std_expect (sol:: TimeEvolutionMultiTrajSol{TE} ) where {TE<: AbstractArray } = dropdims (std (sol. runs_expect, dims = 2 ), dims = 2 )
252+ function std_expect (sol:: TimeEvolutionMultiTrajSol{TE} ) where {TE<: AbstractArray }
253+ # the following standard deviation (std) is defined as the square-root of variance instead of pseudo-variance
254+ # i.e., it is equivalent to (even for complex expectation values):
255+ # dropdims(
256+ # sqrt.(mean(abs2.(sol.expect), dims = 2) .- abs2.(mean(sol.expect, dims = 2))),
257+ # dims = 2
258+ # )
259+ return dropdims (std (sol. expect, corrected = false , dims = 2 ), dims = 2 )
260+ end
242261std_expect (sol:: TimeEvolutionMultiTrajSol{Nothing} ) = nothing
243262
244263# ######################################
0 commit comments