/* iccbin -tpp2 -openmp -L/opt/intel/mkl/10.1.1.019/lib/64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lm */ #include #include #include #include #include #define ITMAX 10000 double ddot_(int* , double* , int* , double* , int* ); main(int argc, char **argv) { if(argc < 2 || argc > 2) { printf(" \n"); exit(0); } int N=atof(argv[1]); if (2*(N/2) == N) { printf("\n N must be odd!\n"); exit(0); } int N2=N*N, Nb=N2/2, Nr=Nb+1, NAr=2*N*(N-1), NAb=NAr, NA=2*NAr; double s; double zb[Nb], zr[Nr], resb[Nb], resr[Nr]; /* Data structure for the matrix: simplified Morse data structure since we know that the diagonal entries are 4 and the off-diagonals are all -1*/ double four=4, one=1; /* jc: column location, j_num: number of nonzero elements */ int jcr[NAr], j_numr[Nr], jcb[NAb], j_numb[Nb]; /* j_ad: address of the beginning of each line */ int j_adr[Nr+1], j_adb[Nb+1]; /* For the structure of the original matrix */ int jc[NA], j_num[N2], p[N2]; clock_t clock0, clock1; int i,j,k,l,m,it=0; double norm=N; int inc=1; /* Initializations: */ for(i=0; i red-black matrix */ for (i=0; i1.e-6) { /* Update red nodes */ for(i=0; i