JuliaMath / Interpolations.jl

Fast, continuous interpolation of discrete datasets in Julia
http://juliamath.github.io/Interpolations.jl/
Other
518 stars 110 forks source link

Mismatch between input datatype and interpolated type for `Float32` #598

Open hzarei4 opened 1 month ago

hzarei4 commented 1 month ago

Suppose you have an array of

a = rand(Float32, (10, 11))

As you have mentioned in this commit, the eltype of the interpolate object

itp = interpolate(a, BSpline(Linear()))

is Float32. Then we want to calculate the value of

julia> typeof(itp(1.1, 1.1))
Float64

Then, interestingly

julia> typeof(itp(1.1f0, 1.1f0))
Float32

I think this is an issue with handling the datatypes. I suggest that the interpolation output type should be the input data a we feed the function with, NOT the input type of the itp.

mkitti commented 1 month ago

Thanks. That seems reasonable. Could you make a pull request?