Closed avik-pal closed 4 weeks ago
julia> interp = LinearInterpolation([rand(2) for _ in 1:2], rand(2)) LinearInterpolation with 2 points ┌────────────┬──────────┬──────────┐ │ time │ u1 │ u2 │ ├────────────┼──────────┼──────────┤ │ 0.00804659 │ 0.662718 │ 0.208611 │ │ 0.711882 │ 0.652273 │ 0.222546 │ └────────────┴──────────┴──────────┘ julia> interp(0.5) 2-element Vector{Float64}: 0.6554169013438129 0.21835102996775396 julia> @code_warntype interp([0.5]) MethodInstance for (::LinearInterpolation{Vector{Vector{Float64}}, Vector{Float64}, Vector{Float64}})(::Vector{Float64}) from (interp::DataInterpolations.AbstractInterpolation)(t::AbstractVector) @ DataInterpolations ~/.julia/packages/DataInterpolations/NoIUa/src/DataInterpolations.jl:24 Arguments interp::LinearInterpolation{Vector{Vector{Float64}}, Vector{Float64}, Vector{Float64}} t::Vector{Float64} Body::Vector{Any} 1 ─ %1 = Base.getproperty(interp, :u)::Vector{Vector{Float64}} │ %2 = DataInterpolations.eltype(%1)::Core.Const(Vector{Float64}) │ %3 = DataInterpolations.eltype(t)::Core.Const(Float64) │ %4 = DataInterpolations.promote_type(%2, %3)::Core.Const(Any) │ %5 = DataInterpolations.similar(t, %4)::Vector{Any} │ %6 = (interp)(%5, t)::Vector{Any} └── return %6
Type unstable when we supply A vector of vector as data. %2 = DataInterpolations.eltype(%1)::Core.Const(Vector{Float64}) seems incorrect; probably, it needs to be eltype(eltype(...)) or something like that.
%2 = DataInterpolations.eltype(%1)::Core.Const(Vector{Float64})
eltype(eltype(...))
Type unstable when we supply A vector of vector as data.
%2 = DataInterpolations.eltype(%1)::Core.Const(Vector{Float64})
seems incorrect; probably, it needs to beeltype(eltype(...))
or something like that.