I have some interpolation itp
from which I want to find the neighboring points of the grid. I checked the docs and found in the developer documentation section WeightedIndex
, which is probably close to what I'm looking for. However, I don't understand the following behavior:
julia> A = reshape(1:27, 3, 3, 3)
3×3×3 reshape(::UnitRange{Int64}, 3, 3, 3) with eltype Int64:
[:, :, 1] =
1 4 7
2 5 8
3 6 9
[:, :, 2] =
10 13 16
11 14 17
12 15 18
[:, :, 3] =
19 22 25
20 23 26
21 24 27
julia> A = reshape(1:27, 3, 3, 3);
julia> itp = LinearInterpolation((-1:1:1,-1:1:1,-1:1:1),A);
julia> x = (1.0,0.0,0.75);
julia> itp(x...)
21.75
julia> wis = Interpolations.weightedindexes((Interpolations.value_weights,), Interpolations.itpinfo(itp)..., x)
(Interpolations.WeightedAdjIndex{2, Float64}(1, (1.0, 0.0)), Interpolations.WeightedAdjIndex{2, Float64}(0, (1.0, 0.0)), Interpolations.WeightedAdjIndex{2, Float64}(0, (0.25, 0.75)))
julia> itp.itp.itp[wis...]
1.0e-323
julia> A[wis...]
-4.25
According to the docs the evaluation of the itp
as well as itp.itp.itp[wis...]
should yield the same result, shouldn't it? Is the scaling the problem? Is there in general a better way to detect all contributing points for the position of interest x
and their corresponding weights?
ah found an issue about this:
https://github.com/JuliaMath/Interpolations.jl/issues/479
Max Köhler has marked this topic as resolved.
Last updated: Nov 06 2024 at 04:40 UTC