cpp: void init_array (int nx, int ny,\nDATA_TYPE POLYBENCH_2D(A,NX,NY,nx,ny),\nDATA_TYPE POLYBENCH_1D(x,NY,ny))\n{\nint i, j;\n\nfor (i = 0; i < ny; i++)\nx[i] = i * M_PI;\nfor (i = 0; i < nx; i++)\nfor (j = 0; j < ny; j++)\nA[i][j] = ((DATA_TYPE) i*(j+1)) / nx;\n}
fortran: subroutine init_array(a, x, nx, ny)\nimplicit none\n\ndouble precision :: M_PI\nparameter(M_PI = 3.14159265358979323846D0)\nDATA_TYPE, dimension(ny, nx) :: a\nDATA_TYPE, dimension(ny) :: x\ninteger :: nx, ny\ninteger :: i, j\ndo i = 1, ny\nx(i) = DBLE(i - 1) * M_PI\ndo j = 1, ny\na(j, i) = (DBLE((i - 1) * (j))) / nx\nend do\nend do\nend subroutine