Precompute weights for multidimensional linear interpolation
问题 I have a non-uniform rectangular grid along D dimensions, a matrix of logical values V on the grid, and a matrix of query data points X. The number of grid points differs across dimensions. I run the interpolation multiple times for the same grid G and query X, but for different values V. The goal is to precompute the indexes and weights for the interpolation and to reuse them, because they are always the same. Here is an example in 2 dimensions, in which I have to compute indexes and values