-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Support for complex matrix ODEs #74
Comments
Yeah, somewhat of a duplicate for #34 . We are addressing this problem with a new AD. |
Thanks! I'm working on a problem and currently exploring possibilities but I'm time-constrained. Seeing #34 wasn't updated in the past 4 months, I was wondering if you had any (vague) timeline for that? |
End of the month. We needed to build a new forward mode AD to fix it and like 5 other issues. The new AD will be released quite soon. |
Any developments on that front? |
It's happening here: https://github.com/YingboMa/ForwardDiff2.jl . Shashi had to take some time off but he's back and will likely continue this. |
Using the most recent versions, Here's a minimal reproduction code: A = [1.0*im 2.0; 3.0 4.0]
u0 = [1.0 0.0*im; 0.0 1.0]
tspan = (0.0, 1.0)
#f(u,p,t) = A*u
function f(du,u,p,t)
du .= (A*u)*(p[1]*t + p[2]*t^2 + p[3]*t^3 + p[4]*t^4)
end
prob = ODEProblem(f,u0,tspan)
utarget = [0.0*im 1.0; 1.0 0.0]
function loss_adjoint(p)
ufinal = last(solve(prob, Tsit5(), p=p).u)
loss = 1 - abs(tr(ufinal*utarget')/2)^2
return loss
end
p = [1.5, 1.0, 3.0, 1.0]
solve(prob, Tsit5()) # <--- this now works
DiffEqFlux.sciml_train(loss_adjoint, p, BFGS(initial_stepnorm = 0.0001)) # <--- this fails This fails with the error:
Full stack trace
TypeError: in TrackedReal, in V, expected V<:Real, got Type{Complex{Float64}}
|
On a related note, it appears it is also impossible to use If I add MethodError: no method matching OrdinaryDiffEq.Tsit5Cache(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::MArray{Tuple{2,2},Complex{Float64},2,4}, ::MArray{Tuple{2,2},Complex{Float64},2,4}, ::MArray{Tuple{2,2},Complex{Float64},2,4}, ::OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}) Full stack trace
MethodError: no method matching OrdinaryDiffEq.Tsit5Cache(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::MArray{Tuple{2,2},Complex{Float64},2,4}, ::MArray{Tuple{2,2},Complex{Float64},2,4}, ::MArray{Tuple{2,2},Complex{Float64},2,4}, ::OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64})
Closest candidates are:
OrdinaryDiffEq.Tsit5Cache(::#226#uType, ::#226#uType, ::#227#rateType, ::#227#rateType, ::#227#rateType, ::#227#rateType, ::#227#rateType, ::#227#rateType, ::#227#rateType, !Matched::#226#uType, !Matched::#226#uType, ::#228#uNoUnitsType, ::#229#TabType) where {#226#uType, #227#rateType, #228#uNoUnitsType, #229#TabType} at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/caches/low_order_rk_caches.jl:272
Should I open a separate issue for this one? |
yeah though I don't know if that's fixable. I'll just tag that as an upstream issue that the reverse-mode AD libraries need a mutable array type. For complex, try |
Thanks for the quick response! The loss function is real in my case, it's just that it is calculated from a complex matrix. When you said "I don't know if that's fixable", do you mean complex numbers at intermediate steps are fundamentally impossible? I tried adding the MethodError: no method matching size(::NamedTuple{(:u, :u_analytic, :errors, :t, :k, :prob, :alg, :interp, :dense, :tslocation, :destats, :retcode),Tuple{Array{Union{Nothing, Array{Complex{Float64},2}},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}}) |
This derivative requires a gradient in the complex plane, so the full example is: using DiffEqSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test
A = [1.0*im 2.0; 3.0 4.0]
u0 = [1.0 0.0*im; 0.0 1.0]
tspan = (0.0, 1.0)
function f(u,p,t)
(A*u)*(p[1]*t + p[2]*t^2 + p[3]*t^3 + p[4]*t^4)
end
p = [1.5 + im, 1.0, 3.0, 1.0]
prob = ODEProblem(f,u0,tspan,p)
utarget = [0.0*im 1.0; 1.0 0.0]
function loss_adjoint(p)
ufinal = last(solve(prob, Tsit5(), p=p, abstol=1e-12, reltol=1e-12))
loss = 1 - abs(tr(ufinal*utarget')/2)^2
return loss
end
grad1 = Zygote.gradient(loss_adjoint,Complex{Float64}[1.5, 1.0, 3.0, 1.0])[1]
grad2 = FiniteDiff.finite_difference_gradient(loss_adjoint,Complex{Float64}[1.5, 1.0, 3.0, 1.0])
@test grad1 ≈ grad2 |
This test was added to SciML/SciMLSensitivity.jl#289 so we can close this when that test merges, but it should work right now. |
Whoa, thanks! I actually started rewriting all my equations by manually splitting the real and imaginary parts, which quickly became tedious. This is going to be a huge boost, thanks again! |
Thanks for the fixes! I tried with the merged commit, and the old error is definitely gone, and the gradient tests pass. In this "proper" example. the gradient test passes, but using DiffEqSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test, DiffEqFlux, Optim
const T = 10.0;
const ω = π/T;
function f(u, p, t)
a = p[1]*sin(ω*t) + p[2]*sin(2*ω*t) + p[3]*sin(3*ω*t) + p[4]*sin(4*ω*t);
A = [1.0 a; a -1.0];
return -im*A*u;
end
u0 = [Complex{Float64}(1) 0; 0 1];
tspan = (0.0, T)
p = [0.7, 1.0, 3.0, 1.0]
prob_ode = ODEProblem{false}(f, u0, tspan, p);
sol_ode = solve(prob_ode, Tsit5());
utarget = [Complex{Float64}(0) im; im 0];
function predict_adjoint(p)
return solve(prob_ode, Tsit5(), p=p, abstol=1e-12, reltol=1e-12)
end
function loss_adjoint(p)
prediction = predict_adjoint(p)
usol = last(prediction)
loss = 1.0 - abs(tr(usol*utarget')/2)^2
return loss
end
grad1 = Zygote.gradient(loss_adjoint,Complex{Float64}[1.5, 1.0, 3.0, 1.0])[1]
grad2 = FiniteDiff.finite_difference_gradient(loss_adjoint,Complex{Float64}[1.5, 1.0, 3.0, 1.0])
@test grad1 ≈ grad2 # <- succeeds
DiffEqFlux.sciml_train(loss_adjoint, p, BFGS(initial_stepnorm = 0.0001)) # <- fails Stacktrace
Stacktrace:
[1] Real at ./complex.jl:37 [inlined]
[2] convert at ./number.jl:7 [inlined]
[3] setindex! at ./array.jl:826 [inlined]
[4] setindex! at ./subarray.jl:301 [inlined]
[5] copyto!(::SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}, ::Array{Complex{Float64},1}) at ./multidimensional.jl:962
[6] copyto! at ./broadcast.jl:905 [inlined]
[7] copyto! at ./broadcast.jl:864 [inlined]
[8] materialize! at ./broadcast.jl:823 [inlined]
[9] (::DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon})(::SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}, ::Array{Complex{Float64},2}, ::Array{Float64,1}, ::Float64, ::Int64) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/concrete_solve.jl:97
[10] (::DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}})(::OrdinaryDiffEq.ODEIntegrator{Tsit5,true,Array{Float64,1},Nothing,Float64,Array{Float64,1},Float64,Float64,Float64,Array{Array{Float64,1},1},ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Array{Float64,1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}}},DiffEqBase.DEStats},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(opnorm),CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Complex{Float64},1},Tuple{}},Array{Float64,1},Float64,Nothing,OrdinaryDiffEq.DefaultInit}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/adjoint_common.jl:277
[11] (::DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}})(::OrdinaryDiffEq.ODEIntegrator{Tsit5,true,Array{Float64,1},Nothing,Float64,Array{Float64,1},Float64,Float64,Float64,Array{Array{Float64,1},1},ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Array{Float64,1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}}},DiffEqBase.DEStats},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(opnorm),CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Complex{Float64},1},Tuple{}},Array{Float64,1},Float64,Nothing,OrdinaryDiffEq.DefaultInit}) at /home/user/.julia/packages/DiffEqCallbacks/N6mXi/src/iterative_and_periodic.jl:12
[12] #35 at /home/user/.julia/packages/DiffEqCallbacks/N6mXi/src/iterative_and_periodic.jl:42 [inlined]
[13] initialize! at /home/user/.julia/packages/DiffEqBase/LGnTa/src/callbacks.jl:325 [inlined]
[14] initialize! at /home/user/.julia/packages/DiffEqBase/LGnTa/src/callbacks.jl:315 [inlined]
[15] initialize_callbacks!(::OrdinaryDiffEq.ODEIntegrator{Tsit5,true,Array{Float64,1},Nothing,Float64,Array{Float64,1},Float64,Float64,Float64,Array{Array{Float64,1},1},ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Array{Float64,1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}}},DiffEqBase.DEStats},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.Tsit5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(opnorm),CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Complex{Float64},1},Tuple{}},Array{Float64,1},Float64,Nothing,OrdinaryDiffEq.DefaultInit}, ::Bool) at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/solve.jl:520
[16] __init(::ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Array{Float64,1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem}, ::Tsit5, ::Tuple{}, ::Tuple{}, ::Tuple{}, ::Type{Val{true}}; saveat::Array{Complex{Float64},1}, tstops::Array{Float64,1}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Bool, callback::CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Rational{Int64}, abstol::Float64, reltol::Float64, qmin::Rational{Int64}, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, qoldinit::Rational{Int64}, fullnormalize::Bool, failfactor::Int64, beta1::Nothing, beta2::Nothing, 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), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/solve.jl:402
[17] #__solve#360 at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/solve.jl:4 [inlined]
[18] solve_call(::ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Array{Float64,1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Float64,1},Array{Float64,1},Array{Complex{Float64},2},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem}, ::Tsit5; merge_callbacks::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{6,Symbol},NamedTuple{(:save_everystep, :save_start, :saveat, :tstops, :abstol, :reltol),Tuple{Bool,Bool,Array{Complex{Float64},1},Array{Float64,1},Float64,Float64}}}) at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:96
[19] #solve_up#454 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:122 [inlined]
[20] #solve#453 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:106 [inlined]
[21] _adjoint_sensitivities(::ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats}, ::InterpolatingAdjoint{0,true,Val{:central},Bool}, ::Tsit5, ::DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon}, ::Array{Float64,1}, ::Nothing; abstol::Float64, reltol::Float64, checkpoints::Array{Float64,1}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/sensitivity_interface.jl:21
[22] adjoint_sensitivities(::ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},false,Array{Float64,1},ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats}, ::Tsit5, ::Vararg{Any,N} where N; sensealg::InterpolatingAdjoint{0,true,Val{:central},Bool}, kwargs::Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol,Symbol},NamedTuple{(:abstol, :reltol),Tuple{Float64,Float64}}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/sensitivity_interface.jl:6
[23] (::DiffEqSensitivity.var"#adjoint_sensitivity_backpass#125"{Tsit5,InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},Array{Float64,1},Tuple{},Colon})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/concrete_solve.jl:113
[24] #526#back at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:55 [inlined]
[25] #175 at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182 [inlined]
[26] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{DiffEqBase.var"#526#back#467"{DiffEqSensitivity.var"#adjoint_sensitivity_backpass#125"{Tsit5,InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},Array{Float64,1},Tuple{},Colon}},Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[27] #solve#453 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:106 [inlined]
[28] (::typeof(∂(#solve#453)))(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0
[29] (::Zygote.var"#175#176"{typeof(∂(#solve#453)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182
[30] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{typeof(∂(#solve#453)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[31] (::typeof(∂(solve##kw)))(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0
[32] predict_adjoint at ./In[22]:24 [inlined]
[33] (::typeof(∂(predict_adjoint)))(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0
[34] loss_adjoint at ./In[22]:28 [inlined]
[35] #175 at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182 [inlined]
[36] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{typeof(∂(loss_adjoint)),Tuple{Tuple{Nothing},Int64}}})(::Int64) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[37] #43 at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:176 [inlined]
[38] (::typeof(∂(λ)))(::Int64) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0
[39] #37 at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface.jl:45 [inlined]
[40] (::DiffEqFlux.var"#46#59"{DiffEqFlux.var"#43#56"{typeof(loss_adjoint)}})(::Array{Float64,1}, ::Array{Float64,1}) at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:199
[41] value_gradient!!(::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}) at /home/user/.julia/packages/NLSolversBase/mGaJg/src/interface.jl:82
[42] initial_state(::BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}, ::Optim.Options{Float64,DiffEqFlux.var"#_cb#55"{DiffEqFlux.var"#53#66",Base.Iterators.Cycle{Tuple{DiffEqFlux.NullData}}}}, ::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}) at /home/user/.julia/packages/Optim/L5T76/src/multivariate/solvers/first_order/bfgs.jl:66
[43] optimize(::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}, ::BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}, ::Optim.Options{Float64,DiffEqFlux.var"#_cb#55"{DiffEqFlux.var"#53#66",Base.Iterators.Cycle{Tuple{DiffEqFlux.NullData}}}}) at /home/user/.julia/packages/Optim/L5T76/src/multivariate/optimize/optimize.jl:33
[44] sciml_train(::Function, ::Array{Float64,1}, ::BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}, ::Base.Iterators.Cycle{Tuple{DiffEqFlux.NullData}}; cb::Function, maxiters::Int64, diffmode::DiffEqFlux.ZygoteDiffMode, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:269
[45] sciml_train at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:163 [inlined] (repeats 2 times)
[46] top-level scope at In[22]:38
It seems to be working if I change function predict_adjoint(p)
return solve(prob_ode, Tsit5(), p=Complex{Float64}.(p), abstol=1e-12, reltol=1e-12)
end Is this the way Another strange thing I came accross is that the gradient test also fails if the definition of const ω = 2*π/T; in which case grad1 is non-zero whereas grad2 is zero. |
I just tried using using DiffEqSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test, DiffEqFlux, Optim
const T = 10.0;
const ω = π/T;
function f(u, p, t)
a = p[1]*sin(ω*t) + p[2]*sin(2*ω*t) + p[3]*sin(3*ω*t) + p[4]*sin(4*ω*t);
A = @SMatrix [1.0 a; a -1.0];
return -im*A*u;
end
u0 = @SMatrix [Complex{Float64}(1) 0; 0 1];
tspan = (0.0, T)
p = @MVector [0.7, 1.0, 3.0, 1.0]
prob_ode = ODEProblem{false}(f, u0, tspan, p);
sol_ode = solve(prob_ode, Tsit5());
utarget = [Complex{Float64}(0) im; im 0];
function predict_adjoint(p)
return solve(prob_ode, Tsit5(), p=Complex{Float64}.(p), abstol=1e-12, reltol=1e-12)
end
function loss_adjoint(p)
prediction = predict_adjoint(p)
usol = last(prediction)
loss = 1.0 - abs(tr(usol*utarget')/2)^2
return loss
end
DiffEqFlux.sciml_train(loss_adjoint, p, BFGS(initial_stepnorm = 0.0001)) # <- fails with the error message:
StacktraceStacktrace: [1] setindex!(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Complex{Float64}, ::Int64) at /home/user/.julia/packages/StaticArrays/mlIi1/src/indexing.jl:3 [2] macro expansion at /home/user/.julia/packages/StaticArrays/mlIi1/src/broadcast.jl:155 [inlined] [3] _broadcast! at /home/user/.julia/packages/StaticArrays/mlIi1/src/broadcast.jl:135 [inlined] [4] _copyto! at /home/user/.julia/packages/StaticArrays/mlIi1/src/broadcast.jl:39 [inlined] [5] copyto! at /home/user/.julia/packages/StaticArrays/mlIi1/src/broadcast.jl:30 [inlined] [6] materialize! at ./broadcast.jl:823 [inlined] [7] macro expansion at /home/user/.julia/packages/DiffEqBase/LGnTa/src/diffeqfastbc.jl:88 [inlined] [8] _ode_interpolant!(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Float64, ::Float64, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Array{SArray{Tuple{2,2},Complex{Float64},2,4},1}, ::OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}, ::Nothing, ::Type{Val{0}}) at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/dense/interpolants.jl:291 [9] ode_interpolant!(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Float64, ::Float64, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Array{SArray{Tuple{2,2},Complex{Float64},2,4},1}, ::OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}, ::Nothing, ::Type{Val{0}}) at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/dense/generic_dense.jl:384 [10] ode_interpolation!(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Float64, ::Function, ::Nothing, ::Type{T} where T, ::Array{Complex{Float64},1}, ::Symbol) at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/dense/generic_dense.jl:327 [11] InterpolationData at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/interp_func.jl:75 [inlined] [12] #_#19 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solutions/ode_solutions.jl:19 [inlined] [13] (::ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats})(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Float64, ::Type{T} where T) at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solutions/ode_solutions.jl:19 (repeats 2 times) [14] (::DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}})(::Array{Complex{Float64},1}, ::Array{Complex{Float64},1}, ::Array{Complex{Float64},1}, ::Float64) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/interpolating_adjoint.jl:60 [15] (::ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing})(::Array{Complex{Float64},1}, ::Vararg{Any,N} where N) at /home/user/.julia/packages/DiffEqBase/LGnTa/src/diffeqfunction.jl:248 [16] initialize!(::OrdinaryDiffEq.ODEIntegrator{Tsit5,true,Array{Complex{Float64},1},Nothing,Float64,Array{Complex{Float64},1},Float64,Float64,Float64,Array{Array{Complex{Float64},1},1},ODESolution{Complex{Float64},2,Array{Array{Complex{Float64},1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},1},1},1},ODEProblem{Array{Complex{Float64},1},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},1},1},Array{Float64,1},Array{Array{Array{Complex{Float64},1},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},1},Array{Complex{Float64},1},Array{Complex{Float64},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}}},DiffEqBase.DEStats},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},1},Array{Complex{Float64},1},Array{Complex{Float64},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},OrdinaryDiffEq.DEOptions{Float64,Float64,Float64,Float64,typeof(DiffEqBase.ODE_DEFAULT_NORM),typeof(opnorm),CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN),typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE),typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK),DataStructures.BinaryHeap{Float64,DataStructures.LessThan},DataStructures.BinaryHeap{Float64,DataStructures.LessThan},Nothing,Nothing,Int64,Array{Float64,1},Array{Complex{Float64},1},Tuple{}},Array{Complex{Float64},1},Complex{Float64},Nothing,OrdinaryDiffEq.DefaultInit}, ::OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},1},Array{Complex{Float64},1},Array{Complex{Float64},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}}) at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/perform_step/low_order_rk_perform_step.jl:623 [17] __init(::ODEProblem{Array{Complex{Float64},1},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem}, ::Tsit5, ::Tuple{}, ::Tuple{}, ::Tuple{}, ::Type{Val{true}}; saveat::Array{Complex{Float64},1}, tstops::Array{Float64,1}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Bool, callback::CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Rational{Int64}, abstol::Float64, reltol::Float64, qmin::Rational{Int64}, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, qoldinit::Rational{Int64}, fullnormalize::Bool, failfactor::Int64, beta1::Nothing, beta2::Nothing, 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), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/solve.jl:403 [18] #__solve#360 at /home/user/.julia/packages/OrdinaryDiffEq/NsugH/src/solve.jl:4 [inlined] [19] solve_call(::ODEProblem{Array{Complex{Float64},1},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction{DiffEqSensitivity.AdjointDiffCache{Nothing,Nothing,Nothing,Nothing,Nothing,Array{Complex{Float64},1},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool}},InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats},Nothing,ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}},Tuple{Symbol},NamedTuple{(:callback,),Tuple{CallbackSet{Tuple{},Tuple{DiscreteCallback{DiffEqCallbacks.var"#33#36"{Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}},DiffEqCallbacks.var"#35#38"{typeof(DiffEqBase.INITIALIZE_DEFAULT),Bool,DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},Base.RefValue{Union{Nothing, Float64}},DiffEqCallbacks.var"#34#37"{DiffEqSensitivity.var"#88#90"{Base.RefValue{Int64},Array{Float64,1}},DiffEqSensitivity.var"#89#91"{DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon},InterpolatingAdjoint{0,true,Val{:central},Bool},Base.OneTo{Int64},UnitRange{Int64},UniformScaling{Bool},Bool,Nothing,Nothing,Nothing,Nothing,Bool,Array{Complex{Float64},1},Array{Float64,1},SArray{Tuple{2,2},Complex{Float64},2,4},Base.RefValue{Int64},Int64,UniformScaling{Bool}},Base.RefValue{Union{Nothing, Float64}}}}}}}}}},DiffEqBase.StandardODEProblem}, ::Tsit5; merge_callbacks::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{6,Symbol},NamedTuple{(:save_everystep, :save_start, :saveat, :tstops, :abstol, :reltol),Tuple{Bool,Bool,Array{Complex{Float64},1},Array{Float64,1},Float64,Float64}}}) at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:96 [20] #solve_up#454 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:122 [inlined] [21] #solve#453 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:106 [inlined] [22] _adjoint_sensitivities(::ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats}, ::InterpolatingAdjoint{0,true,Val{:central},Bool}, ::Tsit5, ::DiffEqSensitivity.var"#df#126"{Array{AbstractArray{Complex{Float64},2},1},SArray{Tuple{2,2},Complex{Float64},2,4},Colon}, ::Array{Float64,1}, ::Nothing; abstol::Float64, reltol::Float64, checkpoints::Array{Float64,1}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/sensitivity_interface.jl:21 [23] adjoint_sensitivities(::ODESolution{Complex{Float64},3,Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Nothing,Nothing,Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},ODEProblem{SArray{Tuple{2,2},Complex{Float64},2,4},Tuple{Float64,Float64},false,Array{Complex{Float64},1},ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,typeof(schrodinger!),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},Array{Float64,1},Array{Array{SArray{Tuple{2,2},Complex{Float64},2,4},1},1},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}},DiffEqBase.DEStats}, ::Tsit5, ::Vararg{Any,N} where N; sensealg::InterpolatingAdjoint{0,true,Val{:central},Bool}, kwargs::Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol,Symbol},NamedTuple{(:abstol, :reltol),Tuple{Float64,Float64}}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/sensitivity_interface.jl:6 [24] (::DiffEqSensitivity.var"#adjoint_sensitivity_backpass#125"{Tsit5,InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},Array{Complex{Float64},1},Tuple{},Colon})(::Array{AbstractArray{Complex{Float64},2},1}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/concrete_solve.jl:113 [25] #526#back at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:55 [inlined] [26] #175 at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182 [inlined] [27] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{DiffEqBase.var"#526#back#467"{DiffEqSensitivity.var"#adjoint_sensitivity_backpass#125"{Tsit5,InterpolatingAdjoint{0,true,Val{:central},Bool},SArray{Tuple{2,2},Complex{Float64},2,4},Array{Complex{Float64},1},Tuple{},Colon}},Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{AbstractArray{Complex{Float64},2},1}) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49 [28] #solve#453 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:106 [inlined] [29] (::typeof(∂(#solve#453)))(::Array{AbstractArray{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0 [30] (::Zygote.var"#175#176"{typeof(∂(#solve#453)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}})(::Array{AbstractArray{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182 [31] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{typeof(∂(#solve#453)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{AbstractArray{Complex{Float64},2},1}) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49 [32] (::typeof(∂(solve##kw)))(::Array{AbstractArray{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0 [33] predict_adjoint at ./In[75]:28 [inlined] [34] (::typeof(∂(predict_adjoint)))(::Array{AbstractArray{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0 [35] loss_adjoint at ./In[75]:32 [inlined] [36] (::typeof(∂(loss_adjoint)))(::Int64) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0 [37] #175 at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182 [inlined] [38] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{typeof(∂(loss_adjoint)),Tuple{Tuple{Nothing},Int64}}})(::Int64) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49 [39] #43 at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:176 [inlined] [40] (::typeof(∂(λ)))(::Int64) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0 [41] #37 at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface.jl:45 [inlined] [42] (::DiffEqFlux.var"#46#59"{DiffEqFlux.var"#43#56"{typeof(loss_adjoint)}})(::Array{Float64,1}, ::Array{Float64,1}) at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:199 [43] value_gradient!!(::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}) at /home/user/.julia/packages/NLSolversBase/mGaJg/src/interface.jl:82 [44] initial_state(::BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}, ::Optim.Options{Float64,DiffEqFlux.var"#_cb#55"{DiffEqFlux.var"#53#66",Base.Iterators.Cycle{Tuple{DiffEqFlux.NullData}}}}, ::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}) at /home/user/.julia/packages/Optim/L5T76/src/multivariate/solvers/first_order/bfgs.jl:66 [45] optimize(::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::Array{Float64,1}, ::BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}, ::Optim.Options{Float64,DiffEqFlux.var"#_cb#55"{DiffEqFlux.var"#53#66",Base.Iterators.Cycle{Tuple{DiffEqFlux.NullData}}}}) at /home/user/.julia/packages/Optim/L5T76/src/multivariate/optimize/optimize.jl:33 [46] sciml_train(::Function, ::Array{Float64,1}, ::BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}, ::Base.Iterators.Cycle{Tuple{DiffEqFlux.NullData}}; cb::Function, maxiters::Int64, diffmode::DiffEqFlux.ZygoteDiffMode, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:269 [47] sciml_train at /home/user/.julia/packages/DiffEqFlux/GYa64/src/train.jl:163 [inlined] (repeats 2 times) [48] top-level scope at In[75]:44 |
I mentioned earlier that static arrays are not supported in the adjoints, and that's not a high priority because if you are using static arrays then adjoints are not the most optimal method, so it's a weird combination. Use forward sensitivities in that case. |
Looks like your example works just fine if you make using DiffEqSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test, DiffEqFlux, Optim
const T = 10.0;
const ω = π/T;
function f(u, p, t)
a = p[1]*sin(ω*t) + p[2]*sin(2*ω*t) + p[3]*sin(3*ω*t) + p[4]*sin(4*ω*t);
A = [1.0 a; a -1.0];
return -im*A*u;
end
u0 = [Complex{Float64}(1) 0; 0 1];
tspan = (0.0, T)
p = Complex{Float64}[0.7, 1.0, 3.0, 1.0]
prob_ode = ODEProblem{false}(f, u0, tspan, p);
sol_ode = solve(prob_ode, Tsit5());
utarget = [Complex{Float64}(0) im; im 0];
function predict_adjoint(p)
return solve(prob_ode, Tsit5(), p=p, abstol=1e-12, reltol=1e-12)
end
function loss_adjoint(p)
prediction = predict_adjoint(p)
usol = last(prediction)
loss = 1.0 - abs(tr(usol*utarget')/2)^2
return loss
end
grad1 = Zygote.gradient(loss_adjoint,Complex{Float64}[1.5, 1.0, 3.0, 1.0])[1]
grad2 = FiniteDiff.finite_difference_gradient(loss_adjoint,Complex{Float64}[1.5, 1.0, 3.0, 1.0])
@test grad1 ≈ grad2 # <- succeeds
res = DiffEqFlux.sciml_train(loss_adjoint, p, BFGS(initial_stepnorm = 0.0001)) # <- fails
res.minimizer # Complex{Float64}[0.3601285857150311 + 0.0im, 0.9525963326731084 + 0.0im, 3.2163299056173216 + 0.0im, 0.9696107069145927 + 0.0im]
loss_adjoint(res.minimizer) # 1.2534417948018017e-12 |
Both compute zero: 4-element Array{Complex{Float64},1}:
-1.170854484124002e-27 + 0.0im
-4.097793673184153e-28 + 0.0im
1.6174714686732235e-27 + 0.0im
-2.9688076044084723e-27 + 0.0im for finite differencing vs 4-element Array{Complex{Float64},1}:
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im for AD. Finite differencing isn't exact, but it's pretty close here. |
OK, thanks a lot for the replies! I am not familiar with the internals of how they work, so I'll just take your word for it with regards to the use of StaticArrays.
When I do that, it actually fails with the following error:
Stacktrace
Stacktrace:
[1] ini_dec(::Base.GenericIOBuffer{Array{UInt8,1}}, ::Complex{Float64}, ::Int64, ::String, ::Int64, ::Int64, ::Char, ::Array{UInt8,1}) at /build/julia/src/julia-1.4.2/usr/share/julia/stdlib/v1.4/Printf/src/Printf.jl:845
[2] (::Optim.var"#2#4")(::Complex{Float64}) at /build/julia/src/julia-1.4.2/usr/share/julia/stdlib/v1.4/Printf/src/Printf.jl:0
[3] iterate at ./generator.jl:47 [inlined]
[4] collect(::Base.Generator{Base.Iterators.Take{Array{Complex{Float64},1}},Optim.var"#2#4"}) at ./array.jl:665
[5] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Optim.MultivariateOptimizationResults{BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat},Float64,Array{Complex{Float64},1},Float64,Float64,Array{OptimizationState{Float64,BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}},1},Bool}) at /home/user/.julia/packages/Optim/L5T76/src/types.jl:242
[6] show at ./multimedia.jl:47 [inlined]
[7] limitstringmime(::MIME{Symbol("text/plain")}, ::Optim.MultivariateOptimizationResults{BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat},Float64,Array{Complex{Float64},1},Float64,Float64,Array{OptimizationState{Float64,BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}},1},Bool}) at /home/user/.julia/packages/IJulia/DrVMH/src/inline.jl:43
[8] display_mimestring(::MIME{Symbol("text/plain")}, ::Optim.MultivariateOptimizationResults{BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat},Float64,Array{Complex{Float64},1},Float64,Float64,Array{OptimizationState{Float64,BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}},1},Bool}) at /home/user/.julia/packages/IJulia/DrVMH/src/display.jl:67
[9] display_dict(::Optim.MultivariateOptimizationResults{BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat},Float64,Array{Complex{Float64},1},Float64,Float64,Array{OptimizationState{Float64,BFGS{LineSearches.InitialStatic{Float64},LineSearches.HagerZhang{Float64,Base.RefValue{Bool}},Nothing,Float64,Flat}},1},Bool}) at /home/user/.julia/packages/IJulia/DrVMH/src/display.jl:96
[10] #invokelatest#1 at ./essentials.jl:712 [inlined]
[11] invokelatest at ./essentials.jl:711 [inlined]
[12] execute_request(::ZMQ.Socket, ::IJulia.Msg) at /home/user/.julia/packages/IJulia/DrVMH/src/execute_request.jl:112
[13] #invokelatest#1 at ./essentials.jl:712 [inlined]
[14] invokelatest at ./essentials.jl:711 [inlined]
[15] eventloop(::ZMQ.Socket) at /home/user/.julia/packages/IJulia/DrVMH/src/eventloop.jl:8
[16] (::IJulia.var"#15#18")() at ./task.jl:358
It works fine, though, when I do the type-cast only when passing |
Oh that's different. It's actually working, but it seems like when you try to |
Oh I see! Thanks, I'll do that! I apologize for coming back with further issues, but it appears that using using DiffEqSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test, DiffEqFlux, Optim
const T = 10.0;
const ω = π/T;
function f1(du, u, p, t)
a = p[1]*sin(ω*t) + p[2]*sin(2*ω*t) + p[3]*sin(3*ω*t) + p[4]*sin(4*ω*t);
A = [1.0 a; a -1.0];
du .= -im*A*u;
end
u0 = [Complex{Float64}(1) 0; 0 1];
tspan = (0.0, T)
p = [0.7, 1.0, 3.0, 1.0]
prob_ode = ODEProblem(f1, u0, tspan, p);
sol_ode = solve(prob_ode, Tsit5());
utarget = [Complex{Float64}(0) im; im 0];
function predict_adjoint(p)
return solve(prob_ode, Tsit5(), p=Complex{Float64}.(p), abstol=1e-12, reltol=1e-12)
end
function loss_adjoint(p)
prediction = predict_adjoint(p)
usol = last(prediction)
loss = 1.0 - abs(tr(usol*utarget')/2)^2
return loss
end
DiffEqFlux.sciml_train(loss_adjoint, p, BFGS(initial_stepnorm = 0.0001))
Stacktrace
Stacktrace:
[1] ReverseDiff.TrackedArray(::Array{Complex{Float64},2}, ::Array{Complex{Float64},2}, ::Array{ReverseDiff.AbstractInstruction,1}) at /home/user/.julia/packages/ReverseDiff/uy0uk/src/tracked.jl:86
[2] track at /home/user/.julia/packages/ReverseDiff/uy0uk/src/tracked.jl:387 [inlined]
[3] #543 at /home/user/.julia/packages/ReverseDiff/uy0uk/src/api/Config.jl:46 [inlined]
[4] map at ./tuple.jl:159 [inlined]
[5] ReverseDiff.GradientConfig(::Tuple{Array{Complex{Float64},2},Array{Complex{Float64},1},Array{Float64,1}}, ::Type{Complex{Float64}}, ::Array{ReverseDiff.AbstractInstruction,1}) at /home/user/.julia/packages/ReverseDiff/uy0uk/src/api/Config.jl:46
[6] GradientConfig at /home/user/.julia/packages/ReverseDiff/uy0uk/src/api/Config.jl:37 [inlined] (repeats 2 times)
[7] ReverseDiff.GradientTape(::Function, ::Tuple{Array{Complex{Float64},2},Array{Complex{Float64},1},Array{Float64,1}}) at /home/user/.julia/packages/ReverseDiff/uy0uk/src/api/tape.jl:204
[8] adjointdiffcache(::Function, ::InterpolatingAdjoint{0,true,Val{:central},Bool}, ::Bool, ::ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},2},Array{Complex{Float64},2},Array{Complex{Float64},2},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}}},DiffEqBase.DEStats}, ::Nothing, ::ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}; quad::Bool, noiseterm::Bool) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/adjoint_common.jl:114
[9] adjointdiffcache at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/adjoint_common.jl:27 [inlined]
[10] DiffEqSensitivity.ODEInterpolatingAdjointSensitivityFunction(::Function, ::InterpolatingAdjoint{0,true,Val{:central},Bool}, ::Bool, ::ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},2},Array{Complex{Float64},2},Array{Complex{Float64},2},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}}},DiffEqBase.DEStats}, ::Nothing, ::Array{Float64,1}, ::NamedTuple{(:reltol, :abstol),Tuple{Float64,Float64}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/interpolating_adjoint.jl:36
[11] ODEAdjointProblem(::ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},2},Array{Complex{Float64},2},Array{Complex{Float64},2},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}}},DiffEqBase.DEStats}, ::InterpolatingAdjoint{0,true,Val{:central},Bool}, ::DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon}, ::Array{Float64,1}, ::Nothing; checkpoints::Array{Float64,1}, callback::CallbackSet{Tuple{},Tuple{}}, reltol::Float64, abstol::Float64, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/interpolating_adjoint.jl:114
[12] _adjoint_sensitivities(::ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},2},Array{Complex{Float64},2},Array{Complex{Float64},2},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}}},DiffEqBase.DEStats}, ::InterpolatingAdjoint{0,true,Val{:central},Bool}, ::Tsit5, ::DiffEqSensitivity.var"#df#126"{Array{Array{Complex{Float64},2},1},Array{Complex{Float64},2},Colon}, ::Array{Float64,1}, ::Nothing; abstol::Float64, reltol::Float64, checkpoints::Array{Float64,1}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/sensitivity_interface.jl:17
[13] adjoint_sensitivities(::ODESolution{Complex{Float64},3,Array{Array{Complex{Float64},2},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},ODEProblem{Array{Complex{Float64},2},Tuple{Float64,Float64},true,Array{Complex{Float64},1},ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{true,typeof(f1),UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Complex{Float64},2},1},Array{Float64,1},Array{Array{Array{Complex{Float64},2},1},1},OrdinaryDiffEq.Tsit5Cache{Array{Complex{Float64},2},Array{Complex{Float64},2},Array{Complex{Float64},2},OrdinaryDiffEq.Tsit5ConstantCache{Complex{Float64},Float64}}},DiffEqBase.DEStats}, ::Tsit5, ::Vararg{Any,N} where N; sensealg::InterpolatingAdjoint{0,true,Val{:central},Bool}, kwargs::Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol,Symbol},NamedTuple{(:abstol, :reltol),Tuple{Float64,Float64}}}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/sensitivity_interface.jl:6
[14] (::DiffEqSensitivity.var"#adjoint_sensitivity_backpass#125"{Tsit5,InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},Array{Complex{Float64},1},Tuple{},Colon})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/DiffEqSensitivity/XiKOH/src/local_sensitivity/concrete_solve.jl:113
[15] #526#back at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:55 [inlined]
[16] #175 at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182 [inlined]
[17] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{DiffEqBase.var"#526#back#467"{DiffEqSensitivity.var"#adjoint_sensitivity_backpass#125"{Tsit5,InterpolatingAdjoint{0,true,Val{:central},Bool},Array{Complex{Float64},2},Array{Complex{Float64},1},Tuple{},Colon}},Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[18] #solve#453 at /home/user/.julia/packages/DiffEqBase/LGnTa/src/solve.jl:106 [inlined]
[19] (::typeof(∂(#solve#453)))(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0
[20] (::Zygote.var"#175#176"{typeof(∂(#solve#453)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/lib/lib.jl:182
[21] (::Zygote.var"#347#back#177"{Zygote.var"#175#176"{typeof(∂(#solve#453)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[22] (::typeof(∂(solve##kw)))(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0
[23] predict_adjoint at ./In[135]:25 [inlined]
[24] (::typeof(∂(predict_adjoint)))(::Array{Array{Complex{Float64},2},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface2.jl:0
[25] loss_adjoint at ./In[135]:29 [inlined]
[26] (::Zygote.var"#37#38"{typeof(∂(loss_adjoint))})(::Float64) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface.jl:45
[27] gradient(::Function, ::Array{Complex{Float64},1}) at /home/user/.julia/packages/Zygote/z3bQd/src/compiler/interface.jl:54
[28] top-level scope at In[135]:34
|
With regards to StaticArrays, actually, it could be significant for performance nonetheless (at least it is, in my case): in the callback function Is it OK if I opened a separate issue for that, or do you prefer not to add support for StaticArrays? |
For intermediate calculations, that's probably a Zygote issue.
The issue is SciML/SciMLSensitivity.jl#113 . There was a partial PR that was never finished: SciML/SciMLSensitivity.jl#61 . There are some advantages that you'd get, but not really too many...
This is a Zygote issue. Zygote can only handle |
Ah, I see. Thanks a lot for the responses & the fixes! |
Hi again, I'm now trying to add a using DiffEqSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test, DiffEqFlux, Optim
const T = 10.0;
const ω = π/T;
ann = FastChain(FastDense(1,32,tanh), FastDense(32,32,tanh), FastDense(32,1))
p = initial_params(ann);
function f_nn(u, p, t)
a = ann([t],p)[1];
A = [1.0 a; a -1.0];
return -im*A*u;
end
u0 = [Complex{Float64}(1) 0; 0 1];
tspan = (0.0, T)
prob_ode = ODEProblem(f_nn, u0, tspan, p);
sol_ode = solve(prob_ode, Tsit5());
utarget = [Complex{Float64}(0) im; im 0];
function predict_adjoint(p)
return solve(prob_ode, Tsit5(), p=Complex{Float64}.(p), abstol=1e-12, reltol=1e-12)
end
function loss_adjoint(p)
prediction = predict_adjoint(p)
usol = last(prediction)
loss = 1.0 - abs(tr(usol*utarget')/2)^2
return loss
end
DiffEqFlux.sciml_train(loss_adjoint, p, ADAM(0.1), maxiters = 100) It runs when using
Stacktrace
MethodError: no method matching derivative(::typeof(activation), ::Complex{Float64})
Closest candidates are:
derivative(::F, !Matched::R) where {F, R<:Real} at /home/user/.julia/packages/ForwardDiff/cXTw0/src/derivative.jl:13
derivative(::Any, !Matched::AbstractArray, !Matched::Real) at /home/user/.julia/packages/ForwardDiff/cXTw0/src/derivative.jl:27
derivative(::Any, !Matched::AbstractArray, !Matched::Real, !Matched::ForwardDiff.DerivativeConfig{T,D} where D) where T at /home/user/.julia/packages/ForwardDiff/cXTw0/src/derivative.jl:27
...
I couldn't be sure if this something that I should be reporting to ForwardDiff or Zygote instead or not. |
it's JuliaDiff/ForwardDiff.jl#455 . We can hardcode more analytical solutions if it helps. These are hardcoded for extra speed: https://github.com/SciML/DiffEqFlux.jl/blob/master/src/fast_layers.jl#L78-L82 |
Oh, great, so once JuliaDiff/ForwardDiff.jl#455 gets merged, I believe we can use an arbitrary activation function! I think it would be nice to have optimized versions for common activation functions, since they can have a strong impact on convergence. |
I'm adapt the first and simplest example in the readme, but
diffeq_rd
doesn't seem to be working with a complex matrix ODE.Even something like
or
doesn't seem to be working. As the initial condition, I'm using a 2x2 identity matrix with Complex{Float64} entries.
t
is Float64.solve()
does work with no issues butdiffeq_rd
givesMethodError: no method matching Array{Float64,1}(::Array{Complex{Float64},2})
The text was updated successfully, but these errors were encountered: