Closed mbauman closed 10 years ago
Whoops, I didn't really intend to push that second commit until this one was merged. But it's good to go, as well. May as well keep them together now.
It adds an extra parameter to InterpIrregular
so the data it's interpolating can be of a different type than the grid:
julia> InterpIrregular([1.,2.,3.], big([2.,3.,4.]), 0., InterpLinear)[1.5]
2.5e+00 with 256 bits of precision
julia> InterpIrregular([1.,2.,3.], big([2.,3.,4.]), 0., InterpLinear)[1.5:2.5]
2-element Array{BigFloat,1}:
2.5e+00
3.5e+00
They're somewhat related, but I can split them apart if you'd prefer.
(There's also a third part… but it's bit bigger and may be a bit more disruptive. I will wait to post that one separately)
Hmm, that is surprising about the inference. Another lesson learned.
Thanks, @mbauman!
For some reason, Julia isn't statically determining that
ndims(A)
comes directly fromA::Array{T}
. As such, the result of@code_typed InterpGrid([1.,2.,3.], BCnan, InterpLinear)
was::InterpGrid{Float64,N,BCnan,InterpLinear}
. Once indexed, it lost all inference and became::Any
.The fix is simple: just grab
N
from the signature and use it instead ofndims(A)
.