Skip to content

Commit 09c4520

Browse files
Add sesolve_map docstring
1 parent b2b5d08 commit 09c4520

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

src/time_evolution/sesolve.jl

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,52 @@ function _gen_sesolve_solution(sol, times, dimensions)
178178
end
179179

180180
@doc raw"""
181-
sesolve_map
181+
sesolve_map(
182+
H::Union{AbstractQuantumObject{Operator},Tuple},
183+
ψ0::Union{QuantumObject{Ket},AbstractVector{<:QuantumObject{Ket}}},
184+
tlist::AbstractVector;
185+
alg::OrdinaryDiffEqAlgorithm = Tsit5(),
186+
ensemblealg::EnsembleAlgorithm = EnsembleThreads(),
187+
e_ops::Union{Nothing,AbstractVector,Tuple} = nothing,
188+
params::Tuple = (NullParameters(),),
189+
progress_bar::Union{Val,Bool} = Val(true),
190+
kwargs...,
191+
)
192+
193+
Solve the Schrödinger equation for multiple initial states and parameter sets using ensemble simulation.
182194
183-
(TBA)
195+
This function computes the time evolution for all combinations (Cartesian product) of initial states and parameter sets, solving the Schrödinger equation (see [`sesolve`](@ref)):
196+
197+
```math
198+
\frac{\partial}{\partial t} |\psi(t)\rangle = -i \hat{H} |\psi(t)\rangle
199+
```
200+
201+
for each combination in the ensemble.
202+
203+
# Arguments
204+
205+
- `H`: Hamiltonian of the system ``\hat{H}``. It can be either a [`QuantumObject`](@ref), a [`QuantumObjectEvolution`](@ref), or a `Tuple` of operator-function pairs.
206+
- `ψ0`: Initial state(s) of the system. Can be a single [`QuantumObject`](@ref) or a `Vector` of initial states.
207+
- `tlist`: List of time points at which to save either the state or the expectation values of the system.
208+
- `alg`: The algorithm for the ODE solver. The default is `Tsit5()`.
209+
- `ensemblealg`: Ensemble algorithm to use for parallel computation. Default is `EnsembleThreads()`.
210+
- `e_ops`: List of operators for which to calculate expectation values. It can be either a `Vector` or a `Tuple`.
211+
- `params`: A `Tuple` of parameter sets. Each element should be an `AbstractVector` representing the sweep range for that parameter. The function will solve for all combinations of initial states and parameter sets.
212+
- `progress_bar`: Whether to show the progress bar. Using non-`Val` types might lead to type instabilities.
213+
- `kwargs`: The keyword arguments for the ODEProblem.
214+
215+
# Notes
216+
217+
- The function returns an array of solutions with dimensions matching the Cartesian product of initial states and parameter sets.
218+
- If `ψ0` is a vector of `m` states and `params = (p1, p2, ...)` where `p1` has length `n1`, `p2` has length `n2`, etc., the output will be of size `(m, n1, n2, ...)`.
219+
- See [`sesolve`](@ref) for more details.
220+
221+
# Returns
222+
223+
- An array of [`TimeEvolutionSol`](@ref) objects with dimensions `(length(ψ0), length(params[1]), length(params[2]), ...)`.
184224
"""
185225
function sesolve_map(
186-
H::Union{QuantumObjectEvolution{Operator},Tuple},
226+
H::Union{AbstractQuantumObject{Operator},Tuple},
187227
ψ0::AbstractVector{<:QuantumObject{Ket}},
188228
tlist::AbstractVector;
189229
alg::OrdinaryDiffEqAlgorithm = Tsit5(),

0 commit comments

Comments
 (0)