code: public double interpolate(double... x) {
          if (x.length != this.x[0].length) {
              throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, this.x[0].length));
          }
  
          double sum = 0.0, sumw = 0.0;
          for (int i = 0; i < this.x.length; i++) {
              double f = rbf.f(Math.distance(x, this.x[i]));
              sumw += w[i] * f;
              sum += f;
          }
  
          return normalized ? sumw / sum : sumw;
      }
docs: Interpolate the function at given point.