Skip to content

Commit d573435

Browse files
committed
update documentation
1 parent 7afdded commit d573435

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

docs/src/resources/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ TimeEvolutionProblem
197197
TimeEvolutionSol
198198
TimeEvolutionMCSol
199199
TimeEvolutionStochasticSol
200+
average_states
201+
average_expect
202+
std_expect
200203
sesolveProblem
201204
mesolveProblem
202205
mcsolveProblem

docs/src/users_guide/time_evolution/solution.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,47 @@ Some other solvers can have other output.
9797

9898
## [Multiple trajectories solution](@id doc-TE:Multiple-trajectories-solution)
9999

100-
This part is still under construction, please read the docstrings for the following functions first:
100+
The solutions are different for solvers which compute multiple trajectories, such as the [`TimeEvolutionMCSol`](@ref) (Monte Carlo) or the [`TimeEvolutionStochasticSol`](@ref) (stochastic methods). The storage of expectation values and states depends on the keyword argument `keep_runs_results`, which determines whether the results of all trajectories are stored in the solution.
101101

102-
- [`TimeEvolutionMCSol`](@ref)
103-
- [`TimeEvolutionStochasticSol`](@ref)
102+
When the keyword argument `keep_runs_results` is passed as `Val(false)` to a multi-trajectory solver, the `states` and `expect` fields store only the average results (averaged over all trajectories). The results can be accessed by the following index-order:
103+
104+
```julia
105+
sol.states[time_idx]
106+
sol.expect[e_op,time_idx]
107+
```
108+
109+
For example:
110+
111+
```@example TE-solution
112+
tlist = LinRange(0, 1, 11)
113+
c_ops = (destroy(2),)
114+
e_ops = (num(2),)
115+
116+
sol_mc1 = mcsolve(H, ψ0, tlist, c_ops, e_ops=e_ops, ntraj=25, keep_runs_results=Val(false), progress_bar=Val(false))
117+
118+
size(sol_mc1.expect)
119+
```
120+
121+
If the keyword argument `keep_runs_results = Val(true)`, the results for each trajectory and each time are stored, and the index-order of the elements in fields `states` and `expect` are:
122+
123+
124+
```julia
125+
sol.states[trajectory,time_idx]
126+
sol.expect[e_op,trajectory,time_idx]
127+
```
128+
129+
For example:
130+
131+
```@example TE-solution
132+
sol_mc2 = mcsolve(H, ψ0, tlist, c_ops, e_ops=e_ops, ntraj=25, keep_runs_results=Val(true), progress_bar=Val(false))
133+
134+
size(sol_mc2.expect)
135+
```
136+
137+
We also provide the following functions for statistical analysis of multi-trajectory `sol`utions:
138+
139+
| **Functions** | **Description** |
140+
|:------------|:----------------|
141+
| [`average_states(sol)`](@ref average_states) | Return the trajectory-averaged result states (as density [`Operator`](@ref)) at each time point. |
142+
| [`average_expect(sol)`](@ref average_expect) | Return the trajectory-averaged expectation values at each time point. |
143+
| [`std_expect(sol)`](@ref std_expect) | Return the trajectory-wise standard deviation of the expectation values at each time point. |

0 commit comments

Comments
 (0)