public double rawinterp(final int jl, final double x) {
    int i,m,ns=0;
    double y,den,dif,dift,ho,hp,w;
    //double *xa = &xx[jl], *ya = &yy[jl];
    double[] c = new double[mm];
    double[] d = new double[mm];
    dif=abs(x-xx[jl+0]);
    for (i=0;i<mm;i++) {
      if ((dift=abs(x-xx[jl+i])) < dif) {
        ns=i;
        dif=dift;
      }
      c[i]=yy[jl+i];
      d[i]=yy[jl+i];
    }
    y=yy[jl+ns--];
    for (m=1;m<mm;m++) {
      for (i=0;i<mm-m;i++) {
        ho=xx[jl+i]-x;
        hp=xx[jl+i+m]-x;
        w=c[i+1]-d[i];
        if ((den=ho-hp) == 0.0) throw new IllegalArgumentException("Poly_interp error");
        den=w/den;
        d[i]=hp*den;
        c[i]=ho*den;
      }
      y += (dy=(2*(ns+1) < (mm-m) ? c[ns+1] : d[ns--]));
    }
    return y;
  }