MAINT: remove dead code (neighbors not None)
@@ -722,6 +722,7 @@ class RBFInterpolator:
self._coeffs = coeffs
else:
+ raise NotImplementedError
self._tree = KDTree(y)
self.y = y
@@ -800,50 +801,6 @@ class RBFInterpolator:
else:
raise NotImplementedError # XXX: needs KDTree
- # Get the indices of the k nearest observation points to each
- # evaluation point.
- _, yindices = self._tree.query(x, self.neighbors)
- if self.neighbors == 1:
- # `KDTree` squeezes the output when neighbors=1.
- yindices = yindices[:, None]
-
- # Multiple evaluation points may have the same neighborhood of
- # observation points. Make the neighborhoods unique so that we only
- # compute the interpolation coefficients once for each
- # neighborhood.
- yindices = cp.sort(yindices, axis=1)
- yindices, inv = cp.unique(yindices, return_inverse=True, axis=0)
- # `inv` tells us which neighborhood will be used by each evaluation
- # point. Now we find which evaluation points will be using each
- # neighborhood.
- xindices = [[] for _ in range(len(yindices))]
- for i, j in enumerate(inv):
- xindices[j].append(i)
-
- out = cp.empty((nx, self.d.shape[1]), dtype=float)
- for xidx, yidx in zip(xindices, yindices):
- # `yidx` are the indices of the observations in this
- # neighborhood. `xidx` are the indices of the evaluation points
- # that are using this neighborhood.
- xnbr = x[xidx]
- ynbr = self.y[yidx]
- dnbr = self.d[yidx]
- snbr = self.smoothing[yidx]
- shift, scale, coeffs = _build_and_solve_system(
- ynbr,
- dnbr,
- snbr,
- self.kernel,
- self.epsilon,
- self.powers,
- )
- out[xidx] = self._chunk_evaluator(
- xnbr,
- ynbr,
- shift,
- scale,
- coeffs)
-
out = out.view(self.d_dtype)
out = out.reshape((nx, ) + self.d_shape)
return out
