//Rprintf("R[%i,%i]=%f\n",i,j,R[give_index(i,j,n)]);
//Rprintf("s[%i,%i]=%i\n",i,j,s[give_index(i,j,n)]);
//Rprintf("D[%i,%i]=%f\n",i,j,D[give_index(i,j,n)]);
//Rprintf("R[%i,%i]=%f\n",i,j,R[give_index(i,j,n)]);
//Rprintf("s[%i,%i]=%i\n",i,j,s[give_index(i,j,n)]);
//Rprintf("D[%i,%i]=%f\n",i,j,D[give_index(i,j,n)]);