public double interp(final double[] pt) {
    double r, w, sum=0., sumw=0.;
    if (pt.length != dim) throw new IllegalArgumentException("RBF_interp bad pt size");
    for (int i=0;i<n;i++) {
      if ((r=rad(pt,pts[i])) == 0.) return vals[i];
      sum += (w = pow(r,pneg));
      sumw += w*vals[i];
    }
    return sumw/sum;
  }