Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForwardDiff fails on (schroedinger_dynamic with) TimeDependentOperator #376

Open
AmitRotem opened this issue Dec 16, 2023 · 6 comments
Open

Comments

@AmitRotem
Copy link
Contributor

derivative on TimeDependentSum fails;

using QuantumOptics
import ForwardDiff as FD
base=SpinBasis(1/2)
ψi = spinup(base)
ψt = spindown(base)

function Ftdop(q)
    H= TimeDependentSum([q, abs2∘sinpi], [sigmaz(base), sigmax(base)])
    _, ψf = timeevolution.schroedinger_dynamic(range(0,1,2), ψi, H)
    abs2(ψt'last(ψf))
end
Ftdop(1.0)
FD.derivative(Ftdop, 1.0) # fail

schroedinger_dynamic promotes tspan and state to Dual when needed, then TimeDependentSum is called with a Dual and fails.

Possible to call _promote_time_and_state here;

function schroedinger_dynamic(tspan, psi0::T, H::AbstractTimeDependentOperator;
kwargs...) where {B,Bp,T<:Union{AbstractOperator{B,Bp},StateVector{B}}}
schroedinger_dynamic(tspan, psi0, schroedinger_dynamic_function(H); kwargs...)
end

and then promote H as TimeDependentSum(op.coefficients, op.static_op; init_time=zero(promote_type(eltype(tspan), typeof(current_time(op)))))
Or somehow pass this to schroedinger_dynamic_function ?

@amilsted
Copy link
Collaborator

Hi Amit! Right, so the problem is indeed the type of the current_time field. We might want it to be a union including the appropriate Dual type here? Does that work if you do it in your Ftdop above?

Actually, I'm a bit puzzled in this case, as you are not taking a derivative wrt. time. Perhaps you could post the stack trace?

@AmitRotem
Copy link
Contributor Author

AmitRotem commented Dec 21, 2023

Hi Ash! I hope you're doing well and having fun!
schroedinger_dynamic is promoting the time and state via DiffEqBase to account for Dual

u0data_promote = DiffEqBase.promote_u0(u0.data, p, tspan[1])
tspan_promote = DiffEqBase.promote_tspan(u0data_promote, p, tspan, nothing, Dict{Symbol, Any}())

This would also happed if I would be taking a derivative wrt. time.

Stack trace;
ERROR: MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1})

Closest candidates are:
  (::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat
   @ Base rounding.jl:207
  (::Type{T})(::T) where T<:Number
   @ Core boot.jl:792
  (::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number}
   @ Base char.jl:50
  ...

Stacktrace:
  [1] convert(#unused#::Type{Float64}, x::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1})
    @ Base .\number.jl:7
  [2] setproperty!(x::TimeDependentSum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ComposedFunction{typeof(abs2), typeof(sinpi)}}, LazySum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Tuple{Operator{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, SparseMatrixCSC{ComplexF64, Int64}}, Operator{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, SparseMatrixCSC{ComplexF64, Int64}}}}, Float64}, f::Symbol, v::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1})
    @ Base .\Base.jl:38
  [3] set_time!
    @ C:\Users\Amit\.julia\packages\QuantumOpticsBase\L1a0O\src\time_dependent_operator.jl:149 [inlined]
  [4] _tdop_schroedinger_wrapper
    @ C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\time_dependent_operators.jl:15 [inlined]
  [5] dschroedinger_dynamic!
    @ C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\schroedinger.jl:103 [inlined]
  [6] dschroedinger_
    @ C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\schroedinger.jl:49 [inlined]
  [7] df_
    @ C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\timeevolution_base.jl:23 [inlined]
  [8] Void
    @ C:\Users\Amit\.julia\packages\SciMLBase\8XHkk\src\utils.jl:481 [inlined]
  [9] (::FunctionWrappers.CallWrapper{Nothing})(f::SciMLBase.Void{QuantumOptics.timeevolution.var"#df_#3"{QuantumOptics.timeevolution.var"#dschroedinger_#52"{QuantumOptics.timeevolution.var"#_tdop_schroedinger_wrapper#9"{TimeDependentSum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ComposedFunction{typeof(abs2), typeof(sinpi)}}, LazySum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Tuple{Operator{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, SparseMatrixCSC{ComplexF64, Int64}}, Operator{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, SparseMatrixCSC{ComplexF64, Int64}}}}, Float64}}}, Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}}}, arg1::Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, arg2::Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, arg3::SciMLBase.NullParameters, arg4::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1})
    @ FunctionWrappers C:\Users\Amit\.julia\packages\FunctionWrappers\Q5cBx\src\FunctionWrappers.jl:65
 [10] macro expansion
    @ C:\Users\Amit\.julia\packages\FunctionWrappers\Q5cBx\src\FunctionWrappers.jl:137 [inlined]
 [11] do_ccall
    @ C:\Users\Amit\.julia\packages\FunctionWrappers\Q5cBx\src\FunctionWrappers.jl:125 [inlined]
 [12] FunctionWrapper
    @ C:\Users\Amit\.julia\packages\FunctionWrappers\Q5cBx\src\FunctionWrappers.jl:144 [inlined]
 [13] _call
    @ C:\Users\Amit\.julia\packages\FunctionWrappersWrappers\9XR0m\src\FunctionWrappersWrappers.jl:12 [inlined]
 [14] FunctionWrappersWrapper
    @ C:\Users\Amit\.julia\packages\FunctionWrappersWrappers\9XR0m\src\FunctionWrappersWrappers.jl:10 [inlined]
 [15] ODEFunction
    @ C:\Users\Amit\.julia\packages\SciMLBase\8XHkk\src\scimlfunctions.jl:2407 [inlined]
 [16] ode_determine_initdt(u0::Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, t::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, tdir::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, dtmax::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, abstol::Float64, reltol::Float64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), prob::SciMLBase.ODEProblem{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, true, SciMLBase.NullParameters, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, integrator::OrdinaryDiffEq.ODEIntegrator{OrdinaryDiffEq.DP5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Nothing, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Float64, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, SciMLBase.ODESolution{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 2, Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, Nothing, Nothing, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}}, SciMLBase.ODEProblem{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, true, SciMLBase.NullParameters, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.DP5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}}, OrdinaryDiffEq.DP5Cache{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, SciMLBase.DEStats, Nothing}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, OrdinaryDiffEq.DP5Cache{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, OrdinaryDiffEq.PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Bool, SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#30#31", DiffEqCallbacks.SavingAffect{QuantumOptics.timeevolution.var"#fout_#4"{Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, QuantumOptics.timeevolution.var"#fout#7"}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, DataStructures.BinaryMinHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(DiffEqCallbacks.saving_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, DataStructures.FasterForward}, DataStructures.BinaryHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Nothing, OrdinaryDiffEq.DefaultInit})
    @ OrdinaryDiffEq C:\Users\Amit\.julia\packages\OrdinaryDiffEq\IsxOE\src\initdt.jl:165
 [17] auto_dt_reset!
    @ C:\Users\Amit\.julia\packages\OrdinaryDiffEq\IsxOE\src\integrators\integrator_interface.jl:449 [inlined]
 [18] handle_dt!(integrator::OrdinaryDiffEq.ODEIntegrator{OrdinaryDiffEq.DP5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Nothing, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Float64, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, SciMLBase.ODESolution{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 2, Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, Nothing, Nothing, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}}, SciMLBase.ODEProblem{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, true, SciMLBase.NullParameters, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.DP5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{Vector{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}}, OrdinaryDiffEq.DP5Cache{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, SciMLBase.DEStats, Nothing}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, OrdinaryDiffEq.DP5Cache{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, OrdinaryDiffEq.PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Bool, SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#30#31", DiffEqCallbacks.SavingAffect{QuantumOptics.timeevolution.var"#fout_#4"{Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, QuantumOptics.timeevolution.var"#fout#7"}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, DataStructures.BinaryMinHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(DiffEqCallbacks.saving_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, DataStructures.FasterForward}, DataStructures.BinaryHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Nothing, OrdinaryDiffEq.DefaultInit})
    @ OrdinaryDiffEq C:\Users\Amit\.julia\packages\OrdinaryDiffEq\IsxOE\src\solve.jl:565
 [19] __init(prob::SciMLBase.ODEProblem{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, true, SciMLBase.NullParameters, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::OrdinaryDiffEq.DP5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Bool, callback::SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#30#31", DiffEqCallbacks.SavingAffect{QuantumOptics.timeevolution.var"#fout_#4"{Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, QuantumOptics.timeevolution.var"#fout#7"}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, DataStructures.BinaryMinHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(DiffEqCallbacks.saving_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}}}, dense::Bool, calck::Bool, dt::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, dtmin::Nothing, dtmax::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, force_dtmin::Bool, adaptive::Bool, gamma::Rational{Int64}, abstol::Float64, reltol::Float64, qmin::Rational{Int64}, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Rational{Int64}, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), progress_id::Symbol, userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ OrdinaryDiffEq C:\Users\Amit\.julia\packages\OrdinaryDiffEq\IsxOE\src\solve.jl:527
 [20] __init (repeats 5 times)
    @ C:\Users\Amit\.julia\packages\OrdinaryDiffEq\IsxOE\src\solve.jl:10 [inlined]
 [21] #__solve#746
    @ C:\Users\Amit\.julia\packages\OrdinaryDiffEq\IsxOE\src\solve.jl:5 [inlined]
 [22] __solve
    @ C:\Users\Amit\.julia\packages\OrdinaryDiffEq\IsxOE\src\solve.jl:1 [inlined]
 [23] solve_call(_prob::SciMLBase.ODEProblem{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, true, SciMLBase.NullParameters, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, FunctionWrappersWrappers.FunctionWrappersWrapper{Tuple{FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, FunctionWrappers.FunctionWrapper{Nothing, Tuple{Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}, SciMLBase.NullParameters, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, 1}}}}, false}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::OrdinaryDiffEq.DP5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::Base.Pairs{Symbol, Any, NTuple{6, Symbol}, NamedTuple{(:reltol, :abstol, :save_everystep, :save_start, :save_end, :callback), Tuple{Float64, Float64, Bool, Bool, Bool, SciMLBase.CallbackSet{Tuple{}, Tuple{SciMLBase.DiscreteCallback{DiffEqCallbacks.var"#30#31", DiffEqCallbacks.SavingAffect{QuantumOptics.timeevolution.var"#fout_#4"{Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, QuantumOptics.timeevolution.var"#fout#7"}, ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, DataStructures.BinaryMinHeap{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, typeof(DiffEqCallbacks.saving_initialize), typeof(SciMLBase.FINALIZE_DEFAULT)}}}}}})
    @ DiffEqBase C:\Users\Amit\.julia\packages\DiffEqBase\LUZAV\src\solve.jl:561
 [24] solve_call
    @ C:\Users\Amit\.julia\packages\DiffEqBase\LUZAV\src\solve.jl:527 [inlined]
 [25] #solve_up#42
    @ C:\Users\Amit\.julia\packages\DiffEqBase\LUZAV\src\solve.jl:1010 [inlined]
 [26] solve_up
    @ C:\Users\Amit\.julia\packages\DiffEqBase\LUZAV\src\solve.jl:996 [inlined]
 [27] #solve#40
    @ C:\Users\Amit\.julia\packages\DiffEqBase\LUZAV\src\solve.jl:933 [inlined]
 [28] integrate(tspan::Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, df::QuantumOptics.timeevolution.var"#dschroedinger_#52"{QuantumOptics.timeevolution.var"#_tdop_schroedinger_wrapper#9"{TimeDependentSum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Tuple{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}, ComposedFunction{typeof(abs2), typeof(sinpi)}}, LazySum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Tuple{Operator{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, SparseMatrixCSC{ComplexF64, Int64}}, Operator{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, SparseMatrixCSC{ComplexF64, Int64}}}}, Float64}}}, x0::Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, state::Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, dstate::Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, fout::QuantumOptics.timeevolution.var"#fout#7"; alg::OrdinaryDiffEq.DP5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, steady_state::Bool, tol::Float64, save_everystep::Bool, saveat::Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, callback::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ QuantumOptics.timeevolution C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\timeevolution_base.jl:59
 [29] integrate(tspan::Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, df::Function, x0::Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, state::Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, dstate::Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, fout::Function)
    @ QuantumOptics.timeevolution C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\timeevolution_base.jl:14
 [30] #integrate#6
    @ C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\timeevolution_base.jl:75 [inlined]
 [31] integrate(tspan::Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, df::Function, x0::Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}, state::Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, dstate::Ket{SpinBasis{1//2, Int64}, Vector{Complex{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}}}, ::Nothing)
    @ QuantumOptics.timeevolution C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\timeevolution_base.jl:70
 [32] schroedinger_dynamic(tspan::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, psi0::Ket{SpinBasis{1//2, Int64}, Vector{ComplexF64}}, f::Function; fout::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ QuantumOptics.timeevolution C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\schroedinger.jl:54
 [33] schroedinger_dynamic
    @ C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\schroedinger.jl:46 [inlined]
 [34] #schroedinger_dynamic#53
    @ C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\schroedinger.jl:59 [inlined]
 [35] schroedinger_dynamic(tspan::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, psi0::Ket{SpinBasis{1//2, Int64}, Vector{ComplexF64}}, H::TimeDependentSum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Vector{Any}, LazySum{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1}}, Vector{Operator{SpinBasis{1//2, Int64}, SpinBasis{1//2, Int64}, SparseMatrixCSC{ComplexF64, Int64}}}}, Float64})
    @ QuantumOptics.timeevolution C:\Users\Amit\.julia\packages\QuantumOptics\6utec\src\schroedinger.jl:57
 [36] Ftdop(q::ForwardDiff.Dual{ForwardDiff.Tag{typeof(Ftdop), Float64}, Float64, 1})
    @ Main c:\Users\Amit\OneDrive\Documents\julia code\project_3\composite_gates.jl:101
 [37] derivative(f::typeof(Ftdop), x::Float64)
    @ ForwardDiff C:\Users\Amit\.julia\packages\ForwardDiff\PcZ48\src\derivative.jl:14
 [38] top-level scope
    @ c:\Users\Amit\OneDrive\Documents\julia code\project_3\composite_gates.jl:105

@AmitRotem
Copy link
Contributor Author

AmitRotem commented Dec 21, 2023

If I initially build the TimeDependentSum with init_time as Dual everything is fine

function Ftdop(q)
    H= TimeDependentSum([q, abs2∘sinpi], [sigmaz(base), sigmax(base)]; init_time=0q)
    _, ψf = timeevolution.schroedinger_dynamic(range(0,1,2), ψi, H)
    abs2(ψt'last(ψf))
end
FD.derivative(Ftdop, 1.0) # O.k.

@amilsted
Copy link
Collaborator

amilsted commented Dec 22, 2023

Thanks. Is it really necessary to promote the times in schroedinger_dynamic? In any case, I think I agree we should be creating a new TimeDependentSum automatically with the correct time type here. It's required at minimum for derivatives wrt time.

@AmitRotem
Copy link
Contributor Author

DiffEq will promote the times if the input state is a Dual, so actually there's no need to promote the times in QO when using a function as the Hamiltonian.
But this still mean TimeDependentSum needs to be promoted.

@AmitRotem
Copy link
Contributor Author

I've added this solution #378

Maybe another solution could be propagating the Dual type all the way to https://github.com/qojulia/QuantumOpticsBase.jl/blob/5ad71582770c217718848e14f649ee7b39b2b6db/src/time_dependent_operator.jl#L139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants