  for (SizeT k = 0; k < ny; ++k) {
    for (SizeT j = 0; j < nx; ++j) { //nb output points
      vres = &(res[ncontiguous * (k * nx + j) ]);
      x = xx[j];
      if (x < 0) {
        xi = 0;
      } else if (x >= n1-1 ) {
        xi = n1-1;
      } else {
        xi = floor(x);
      }
      y = yy[k];
      if (y < 0) {
        yi = 0; 
      } else if (y >= n2-1 ) {
        yi = n2-1; 
      } else {
        yi = floor(y);
      }
      vx0 = &(array[ncontiguous * (yi * n1 + xi)]);
      for (SizeT i = 0; i < ncontiguous; ++i) {
        vres[i] = vx0[i];
      }
    }
  }