Skip to content

Instantly share code, notes, and snippets.

@ChrisRackauckas
Created March 13, 2017 19:30
Show Gist options
  • Save ChrisRackauckas/c8e5e0b45b1aef7722e4dfdd92e6253d to your computer and use it in GitHub Desktop.
Save ChrisRackauckas/c8e5e0b45b1aef7722e4dfdd92e6253d to your computer and use it in GitHub Desktop.
julia> cache = init(prob,DP5())
typeof(utilde) = Array{Float64,2}
typeof(cache) = OrdinaryDiffEq.DP5Cache{Array{Float64,2},Any,Array{Float64,2},Any,Any}
cache = OrdinaryDiffEq.DP5Cache{Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.DP5ConstantCache{Float64,Float64}}([0.260125 0.9676; 0.190313 0.645691; 0.660911 0.545968; 0.0671932 0.526845], [0.260125 0.9676; 0.190313 0.645691; 0.660911 0.545968; 0.0671932 0.526845], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], OrdinaryDiffEq.DP5ConstantCache{Float64,Float64}(0.2, 0.075, 0.225, 0.9777777777777777, -3.7333333333333334, 3.5555555555555554, 2.9525986892242035, -11.595793324188385, 9.822892851699436, -0.2908093278463649, 2.8462752525252526, -10.757575757575758, 8.906422717743473, 0.2784090909090909, -0.2735313036020583, 0.09114583333333333, 0.44923629829290207, 0.6510416666666666, -0.322376179245283, 0.13095238095238096, 0.08991319444444444, 0.4534890685834082, 0.6140625, -0.2715123820754717, 0.08904761904761904, 0.025, 0.2, 0.3, 0.8, 0.8888888888888888, 1.0, 1.0, -1.1270175653862835, 2.675424484351598, -5.685526961588504, 3.5219323679207912, -1.7672812570757455, 2.382468931778144))
mytypeof(cache) = OrdinaryDiffEq.DP5Cache{Array{Float64,2},Any,Array{Float64,2},Any,Any}
typeof(cache) = OrdinaryDiffEq.DP5Cache{Array{Float64,2},Any,Array{Float64,2},Any,Any}
OrdinaryDiffEq.DP5Cache{Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.DP5ConstantCache{Float64,Float64}}([0.260125 0.9676; 0.190313 0.645691; 0.660911 0.545968; 0.0671932 0.526845], [0.260125 0.9676; 0.190313 0.645691; 0.660911 0.545968; 0.0671932 0.526845], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0], OrdinaryDiffEq.DP5ConstantCache{Float64,Float64}(0.2, 0.075, 0.225, 0.9777777777777777, -3.7333333333333334, 3.5555555555555554, 2.9525986892242035, -11.595793324188385, 9.822892851699436, -0.2908093278463649, 2.8462752525252526, -10.757575757575758, 8.906422717743473, 0.2784090909090909, -0.2735313036020583, 0.09114583333333333, 0.44923629829290207, 0.6510416666666666, -0.322376179245283, 0.13095238095238096, 0.08991319444444444, 0.4534890685834082, 0.6140625, -0.2715123820754717, 0.08904761904761904, 0.025, 0.2, 0.3, 0.8, 0.8888888888888888, 1.0, 1.0, -1.1270175653862835, 2.675424484351598, -5.685526961588504, 3.5219323679207912, -1.7672812570757455, 2.382468931778144))
julia> @code_typed init(prob,DP5())
CodeInfo(:(begin
NewvarNode(:(u))
NewvarNode(:(uEltypeNoUnits))
NewvarNode(:(tTypeNoUnits))
NewvarNode(:(rate_prototype))
NewvarNode(:(uprev))
NewvarNode(:(cache))
tspan = (Core.getfield)(prob, :tspan)::Tuple{Float64,Float64} # line 10:
SSAValue(10) = (Base.nfields)(tspan)::Int64
SSAValue(11) = (Base.sub_float)((Base.getfield)(tspan, SSAValue(10))::Float64, (Base.getfield)(tspan, 1)::Float64)::Float64
$(Expr(:inbounds, false))
# meta: location number.jl sign 80
# meta: location float.jl < 487
fy = (Base.sitofp)(Float64, 0)::Float64
# meta: pop location
# meta: location operators.jl > 216
# meta: location float.jl < 478
fx = (Base.sitofp)(Float64, 0)::Float64
# meta: pop location
# meta: pop location
# meta: pop location
$(Expr(:inbounds, :pop)) # line 12:
t = (Base.getfield)(tspan, 1)::Float64 # line 14:
f = (Core.getfield)(prob, :f)::DiffEqProblemLibrary.##9#10 # line 15:
u0 = (Core.getfield)(prob, :u0)::Array{Float64,2} # line 20:
SSAValue(0) = ($(Expr(:static_parameter, 1)) <: OrdinaryDiffEq.Array)::Bool
goto 32
32:
SSAValue(0)
u = $(Expr(:foreigncall, :(:jl_array_copy), Ref{Array{Float64,2}}, svec(Any), :(u0), 0))
goto 36
36: # line 22:
$(Expr(:foreigncall, :(:jl_alloc_array_1d), Array{Array{Float64,2},1}, svec(Any, Int64), :($(QuoteNode(Array{Array{Float64,2},1}))), 0, 0, 0)) # line 26:
uEltypeNoUnits = $(QuoteNode(Float64)) # line 27:
tTypeNoUnits = $(QuoteNode(Float64)) # line 29:
($(QuoteNode(Array{Float64,2})) <: OrdinaryDiffEq.AbstractArray)::Bool # line 30:
$(Expr(:invoke, MethodInstance for /(::Array{Float64,2}, ::Float64), :(OrdinaryDiffEq./), :(u), :((Base.sitofp)(Float64, 0)::Float64)))
$(Expr(:inbounds, false))
# meta: location abstractarray.jl indices 56
SSAValue(16) = (Base.arraysize)(u, 1)::Int64
SSAValue(17) = (Base.arraysize)(u, 2)::Int64
# meta: pop location
$(Expr(:inbounds, :pop))
SSAValue(42) = (Base.select_value)((Base.slt_int)(SSAValue(16), 0)::Bool, 0, SSAValue(16))::Int64
SSAValue(43) = (Base.select_value)((Base.slt_int)(SSAValue(17), 0)::Bool, 0, SSAValue(17))::Int64
$(Expr(:inbounds, false))
# meta: location abstractarray.jl similar 508
SSAValue(23) = SSAValue(42)
SSAValue(24) = SSAValue(43)
# meta: pop location
$(Expr(:inbounds, :pop))
rate_prototype = $(Expr(:foreigncall, :(:jl_alloc_array_2d), Array{Float64,2}, svec(Any, Int64, Int64), :($(QuoteNode(Array{Float64,2}))), 0, SSAValue(23), 0, SSAValue(24), 0))
goto 64 # line 32:
64: # line 36:
uprev = $(Expr(:foreigncall, :(:jl_array_copy), Ref{Array{Float64,2}}, svec(Any), :(u), 0)) # line 39:
cache = $(Expr(:invoke, MethodInstance for alg_cache(::OrdinaryDiffEq.DP5, ::Array{Float64,2}, ::Array{Float64,2}, ::Type{T} where T, ::Type{T} where T, ::Array{Float64,2}, ::Array{Float64,2}, ::Function, ::Float64, ::Type{Val{true}}), :(OrdinaryDiffEq.alg_cache), :(alg), :(u), :(rate_prototype), :(uEltypeNoUnits), :(tTypeNoUnits), :(uprev), :(uprev), :(f), :(t), :($(QuoteNode(Val{true}))))) # line 41:
SSAValue(1) = "cache = "
$(Expr(:inbounds, false))
# meta: location strings/io.jl repr 145
s@_26 = $(Expr(:invoke, MethodInstance for Base.AbstractIOBuffer{Array{UInt8,1}}(::Bool, ::Bool), :(Base.IOBuffer), true, true)) # line 146:
$(Expr(:invoke, MethodInstance for showall(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::OrdinaryDiffEq.DP5Cache{Array{Float64,2},Any,Array{Float64,2},Any,Any}), :(Base.showall), :(s@_26), :(cache))) # line 147:
SSAValue(25) = $(Expr(:invoke, MethodInstance for take!(::Base.AbstractIOBuffer{Array{UInt8,1}}), :(Base.take!), :(s@_26)))
# meta: pop location
$(Expr(:inbounds, :pop))
SSAValue(3) = $(Expr(:foreigncall, :(:jl_array_to_string), Ref{String}, svec(Any), SSAValue(25), 0))
$(Expr(:inbounds, false))
# meta: location coreio.jl println 5
SSAValue(27) = (Core.typeassert)(Base.STDOUT, Base.IO)::IO
SSAValue(28) = SSAValue(1)
SSAValue(29) = SSAValue(3)
# meta: pop location
$(Expr(:inbounds, :pop))
(Base.print)(SSAValue(27), SSAValue(28), SSAValue(29), '\n')::Void # line 42:
SSAValue(4) = "mytypeof(cache) = "
# meta: location show.jl # line 243:
SSAValue(5) = $(QuoteNode(OrdinaryDiffEq.DP5Cache{Array{Float64,2},Any,Array{Float64,2},Any,Any}))
# meta: pop location
$(Expr(:inbounds, false))
# meta: location strings/io.jl repr 145
s@_27 = $(Expr(:invoke, MethodInstance for Base.AbstractIOBuffer{Array{UInt8,1}}(::Bool, ::Bool), :(Base.IOBuffer), true, true)) # line 146:
$(Expr(:invoke, MethodInstance for showall(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Type{T} where T), :(Base.showall), :(s@_27), SSAValue(5))) # line 147:
SSAValue(30) = $(Expr(:invoke, MethodInstance for take!(::Base.AbstractIOBuffer{Array{UInt8,1}}), :(Base.take!), :(s@_27)))
# meta: pop location
$(Expr(:inbounds, :pop))
SSAValue(6) = $(Expr(:foreigncall, :(:jl_array_to_string), Ref{String}, svec(Any), SSAValue(30), 0))
$(Expr(:inbounds, false))
# meta: location coreio.jl println 5
SSAValue(32) = (Core.typeassert)(Base.STDOUT, Base.IO)::IO
SSAValue(33) = SSAValue(4)
SSAValue(34) = SSAValue(6)
# meta: pop location
$(Expr(:inbounds, :pop))
(Base.print)(SSAValue(32), SSAValue(33), SSAValue(34), '\n')::Void # line 43:
SSAValue(7) = "typeof(cache) = "
# meta: location show.jl # line 243:
SSAValue(8) = $(QuoteNode(OrdinaryDiffEq.DP5Cache{Array{Float64,2},Any,Array{Float64,2},Any,Any}))
# meta: pop location
$(Expr(:inbounds, false))
# meta: location strings/io.jl repr 145
s@_28 = $(Expr(:invoke, MethodInstance for Base.AbstractIOBuffer{Array{UInt8,1}}(::Bool, ::Bool), :(Base.IOBuffer), true, true)) # line 146:
$(Expr(:invoke, MethodInstance for showall(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Type{T} where T), :(Base.showall), :(s@_28), SSAValue(8))) # line 147:
SSAValue(35) = $(Expr(:invoke, MethodInstance for take!(::Base.AbstractIOBuffer{Array{UInt8,1}}), :(Base.take!), :(s@_28)))
# meta: pop location
$(Expr(:inbounds, :pop))
SSAValue(9) = $(Expr(:foreigncall, :(:jl_array_to_string), Ref{String}, svec(Any), SSAValue(35), 0))
$(Expr(:inbounds, false))
# meta: location coreio.jl println 5
SSAValue(37) = (Core.typeassert)(Base.STDOUT, Base.IO)::IO
SSAValue(38) = SSAValue(7)
SSAValue(39) = SSAValue(9)
# meta: pop location
$(Expr(:inbounds, :pop))
(Base.print)(SSAValue(37), SSAValue(38), SSAValue(39), '\n')::Void # line 44:
return cache
end))=>OrdinaryDiffEq.DP5Cache{Array{Float64,2},Any,Array{Float64,2},Any,Any}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment