File tree Expand file tree Collapse file tree 6 files changed +19
-5
lines changed Expand file tree Collapse file tree 6 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -409,7 +409,7 @@ function lr_mesolveProblem(
409409 c_ops = get_data .(c_ops)
410410 e_ops = get_data .(e_ops)
411411
412- t_l = convert (Vector{ _FType (H)}, tlist )
412+ t_l = _check_tlist (tlist, _FType (H))
413413
414414 # Initialization of Arrays
415415 expvals = Array {ComplexF64} (undef, length (e_ops), length (t_l))
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ function mcsolveProblem(
167167 c_ops isa Nothing &&
168168 throw (ArgumentError (" The list of collapse operators must be provided. Use sesolveProblem instead." ))
169169
170- tlist = convert (Vector{ _FType (ψ0)}, tlist) # Convert it to support GPUs and avoid type instabilities for OrdinaryDiffEq.jl
170+ tlist = _check_tlist (tlist, _FType (ψ0))
171171
172172 H_eff_evo = _mcsolve_make_Heff_QobjEvo (H, c_ops)
173173
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ function mesolveProblem(
6868 haskey (kwargs, :save_idxs ) &&
6969 throw (ArgumentError (" The keyword argument \" save_idxs\" is not supported in QuantumToolbox." ))
7070
71- tlist = convert (Vector{ _FType (ψ0)}, tlist) # Convert it to support GPUs and avoid type instabilities for OrdinaryDiffEq.jl
71+ tlist = _check_tlist (tlist, _FType (ψ0))
7272
7373 L_evo = _mesolve_make_L_QobjEvo (H, c_ops)
7474 check_dimensions (L_evo, ψ0)
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function sesolveProblem(
5959 haskey (kwargs, :save_idxs ) &&
6060 throw (ArgumentError (" The keyword argument \" save_idxs\" is not supported in QuantumToolbox." ))
6161
62- tlist = convert (Vector{ _FType (ψ0)}, tlist) # Convert it to support GPUs and avoid type instabilities for OrdinaryDiffEq.jl
62+ tlist = _check_tlist (tlist, _FType (ψ0))
6363
6464 H_evo = _sesolve_make_U_QobjEvo (H) # Multiply by -i
6565 isoper (H_evo) || throw (ArgumentError (" The Hamiltonian must be an Operator." ))
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ function ssesolveProblem(
162162 sc_ops isa Nothing &&
163163 throw (ArgumentError (" The list of collapse operators must be provided. Use sesolveProblem instead." ))
164164
165- tlist = convert (Vector{Float64}, tlist) # Convert it into Float64 to avoid type instabilities for StochasticDiffEq.jl
165+ tlist = _check_tlist (tlist, _FType (ψ0))
166166
167167 H_eff_evo = _mcsolve_make_Heff_QobjEvo (H, sc_ops)
168168 isoper (H_eff_evo) || throw (ArgumentError (" The Hamiltonian must be an Operator." ))
Original file line number Diff line number Diff line change @@ -212,6 +212,20 @@ struct DiscreteLindbladJumpCallback <: LindbladJumpCallbackType end
212212
213213ContinuousLindbladJumpCallback (; interp_points:: Int = 10 ) = ContinuousLindbladJumpCallback (interp_points)
214214
215+ function _check_tlist (tlist, T:: Type )
216+
217+ tlist = convert (Vector{T}, tlist) # Convert it to support GPUs and avoid type instabilities for OrdinaryDiffEq.jl
218+
219+ # Check if the list of times is not empty
220+ isempty (tlist) && throw (ArgumentError (" The list of times must not be empty." ))
221+ # Check if the list of times is sorted
222+ ! issorted (tlist) && throw (ArgumentError (" The list of times must be sorted." ))
223+ # Check if the list of times is unique
224+ length (tlist) != length (unique (tlist)) && throw (ArgumentError (" The list of times must be unique." ))
225+
226+ return tlist
227+ end
228+
215229# ######################################
216230
217231function liouvillian_floquet (
You can’t perform that action at this time.
0 commit comments