Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Introduce new methods of `sesolve_map` and `mesolve_map` for advanced usage. Users can now customize their own `iter`ator structure, `prob_func` and `output_func`. ([#565])
- Use `ProgressMeter.jl` for progress bar rather than our in-house implementation. ([#569])
- Simplify type structure for time evolution solutions. ([#572])

## [v0.37.0]
Release date: 2025-10-12
Expand Down Expand Up @@ -341,3 +342,4 @@ Release date: 2024-11-13
[#557]: https://github.com/qutip/QuantumToolbox.jl/issues/557
[#565]: https://github.com/qutip/QuantumToolbox.jl/issues/565
[#569]: https://github.com/qutip/QuantumToolbox.jl/issues/569
[#572]: https://github.com/qutip/QuantumToolbox.jl/issues/572
7 changes: 3 additions & 4 deletions src/time_evolution/lr_mesolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ struct TimeEvolutionLRSol{
TE<:Matrix{ComplexF64},
RetT<:Enum,
AlgT<:OrdinaryDiffEqAlgorithm,
AT<:Real,
RT<:Real,
TolT<:Real,
TSZB<:AbstractVector,
TM<:Vector{<:Integer},
}
Expand All @@ -38,8 +37,8 @@ struct TimeEvolutionLRSol{
fexpect::TE
retcode::RetT
alg::AlgT
abstol::AT
reltol::RT
abstol::TolT
reltol::TolT
z::TSZB
B::TSZB
M::TM
Expand Down
35 changes: 16 additions & 19 deletions src/time_evolution/time_evolution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ struct TimeEvolutionSol{
TE<:Union{AbstractMatrix,Nothing},
RETT<:Enum,
AlgT<:OrdinaryDiffEqAlgorithm,
AT<:Real,
RT<:Real,
TolT<:Real,
}
times::TT1
times_states::TT2
states::TS
expect::TE
retcode::RETT
alg::AlgT
abstol::AT
reltol::RT
abstol::TolT
reltol::TolT
end

function Base.show(io::IO, sol::TimeEvolutionSol)
Expand Down Expand Up @@ -140,8 +139,7 @@ struct TimeEvolutionMCSol{
TJT<:Vector{<:Vector{<:Real}},
TJW<:Vector{<:Vector{<:Integer}},
AlgT<:OrdinaryDiffEqAlgorithm,
AT<:Real,
RT<:Real,
TolT<:Real,
} <: TimeEvolutionMultiTrajSol{TS,TE}
ntraj::Int
times::TT1
Expand All @@ -152,8 +150,8 @@ struct TimeEvolutionMCSol{
col_which::TJW
converged::Bool
alg::AlgT
abstol::AT
reltol::RT
abstol::TolT
reltol::TolT
end

function Base.show(io::IO, sol::TimeEvolutionMCSol)
Expand Down Expand Up @@ -215,8 +213,7 @@ struct TimeEvolutionStochasticSol{
TE<:Union{AbstractArray,Nothing},
TEM<:Union{AbstractArray,Nothing},
AlgT<:StochasticDiffEqAlgorithm,
AT<:Real,
RT<:Real,
TolT<:Real,
} <: TimeEvolutionMultiTrajSol{TS,TE}
ntraj::Int
times::TT1
Expand All @@ -226,8 +223,8 @@ struct TimeEvolutionStochasticSol{
measurement::TEM
converged::Bool
alg::AlgT
abstol::AT
reltol::RT
abstol::TolT
reltol::TolT
end

function Base.show(io::IO, sol::TimeEvolutionStochasticSol)
Expand Down Expand Up @@ -408,33 +405,33 @@ function _ensemble_dispatch_prob_func(rng, ntraj, tlist, prob_func; kwargs...)
end

function _ensemble_dispatch_solve(
ens_prob_mc::TimeEvolutionProblem,
ens_prob::TimeEvolutionProblem,
alg::Union{<:OrdinaryDiffEqAlgorithm,<:StochasticDiffEqAlgorithm},
ensemblealg::ET,
ntraj::Int,
) where {ET<:Union{EnsembleSplitThreads,EnsembleDistributed}}
sol = nothing

@sync begin
@async while take!(ens_prob_mc.kwargs.channel)
next!(ens_prob_mc.kwargs.progr)
@async while take!(ens_prob.kwargs.channel)
next!(ens_prob.kwargs.progr)
end

@async begin
sol = solve(ens_prob_mc.prob, alg, ensemblealg, trajectories = ntraj)
put!(ens_prob_mc.kwargs.channel, false)
sol = solve(ens_prob.prob, alg, ensemblealg, trajectories = ntraj)
put!(ens_prob.kwargs.channel, false)
end
end

return sol
end
function _ensemble_dispatch_solve(
ens_prob_mc::TimeEvolutionProblem,
ens_prob::TimeEvolutionProblem,
alg::Union{<:OrdinaryDiffEqAlgorithm,<:StochasticDiffEqAlgorithm},
ensemblealg,
ntraj::Int,
)
sol = solve(ens_prob_mc.prob, alg, ensemblealg, trajectories = ntraj)
sol = solve(ens_prob.prob, alg, ensemblealg, trajectories = ntraj)
return sol
end

Expand Down
Loading