Open
Description
Lorenz example from the docs has type instabilities both in the problem definition and the solve
call.
function lorenz!(du,u,p,t)
du[1] = 10.0*(u[2]-u[1])
du[2] = u[1]*(28.0-u[3]) - u[2]
du[3] = u[1]*u[2] - (8/3)*u[3]
end
using DifferentialEquations
u0 = [1.0;0.0;0.0]
tspan = (0.0,100.0)
prob = ODEProblem(lorenz!,u0,tspan)
sol = solve(prob)
@code_warntype ODEProblem(lorenz!,u0,tspan)
MethodInstance for ODEProblem(::typeof(lorenz!), ::Vector{Float64}, ::Tuple{Float64, Float64})
from ODEProblem(f, u0, tspan) in SciMLBase at C:\Users\Math User\.julia\packages\SciMLBase\hLrpl\src\problems\ode_problems.jl:167
Arguments
#self#::Type{ODEProblem}
f::Core.Const(lorenz!)
u0::Vector{Float64}
tspan::Tuple{Float64, Float64}
Body::Any
1 ─ %1 = SciMLBase.NullParameters()::Core.Const(SciMLBase.NullParameters())
│ %2 = (#self#)(f, u0, tspan, %1)::Any
└── return %2
@code_warntype solve(prob)
MethodInstance for CommonSolve.solve(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, ODEFunction{true, SciMLBase.AutoSpecialize, typeof(lorenz!), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem})
from solve(prob::SciMLBase.AbstractDEProblem, args...; sensealg, u0, p, wrap, kwargs...) in DiffEqBase at C:\Users\Math User\.julia\packages\DiffEqBase\egmnd\src\solve.jl:815
Arguments
#self#::Core.Const(CommonSolve.solve)
prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, ODEFunction{true, SciMLBase.AutoSpecialize, typeof(lorenz!), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}
args::Tuple{}
Body::Any
1 ─ %1 = DiffEqBase.Val(true)::Core.Const(Val{true}())
│ %2 = Core.NamedTuple()::Core.Const(NamedTuple())
│ %3 = Base.pairs(%2)::Core.Const(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
│ %4 = Core.tuple(DiffEqBase.nothing, DiffEqBase.nothing, DiffEqBase.nothing, %1, %3, #self#, prob)::Tuple{Nothing, Nothing, Nothing, Val{true}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(solve), ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, ODEFunction{true, SciMLBase.AutoSpecialize, typeof(lorenz!), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}}
│ %5 = Core._apply_iterate(Base.iterate, DiffEqBase.:(var"#solve#27"), %4, args)::Any
└── return %5
Metadata
Metadata
Assignees
Labels
No labels