code: public double[] toWraparoundOrder(double data[], int rowspan){
      if (rowspan == 2*ncols) return data;
      double newdata[] = new double[2*nrows*ncols];
      for(int i=0; i<nrows; i++)
        for(int j=0; j<ncols; j++) {
  	newdata[i*2*ncols + 2*j]=data[i*rowspan +2*j];
  	newdata[i*2*ncols + 2*j+1]=data[i*rowspan +2*j+1]; }
      return newdata; }
docs: Return data in wraparound order.
  rowspan is used to traverse data; the new array is in
  packed (rowspan = 2*ncols) format.
  @see <a href="package-summary.html#wraparound">wraparound format</A>