cpp: void init_array (int n,\nDATA_TYPE POLYBENCH_2D(y,N,N,n,n),\nDATA_TYPE POLYBENCH_2D(sum,N,N,n,n),\nDATA_TYPE POLYBENCH_1D(alpha,N,n),\nDATA_TYPE POLYBENCH_1D(beta,N,n),\nDATA_TYPE POLYBENCH_1D(r,N,n))\n{\nint i, j;\n\nfor (i = 0; i < n; i++)\n{\nalpha[i] = i;\nbeta[i] = (i+1)/n/2.0;\nr[i] = (i+1)/n/4.0;\nfor (j = 0; j < n; j++) {\ny[i][j] = ((DATA_TYPE) i*j) / n;\nsum[i][j] = ((DATA_TYPE) i*j) / n;\n}\n}\n}
fortran: subroutine init_array(n, y, sumArray, alpha, beta, r)\nimplicit none\n\nDATA_TYPE, dimension(n, n) :: y\nDATA_TYPE, dimension(n, n) :: sumArray\nDATA_TYPE, dimension(n) :: beta\nDATA_TYPE, dimension(n) :: alpha\nDATA_TYPE, dimension(n) :: r\ninteger :: i, j\ninteger :: n\n\ndo i = 1, n\nalpha(i) = i\nbeta(i) = (i/n)/DBLE(2.0)\nr(i)  = (i/n)/DBLE(4.0)\ndo j = 1, n\ny(j,i) = DBLE(i*j)/DBLE(n)\nsumArray(j,i) = DBLE(i*j)/DBLE(n)\nend do\nend do\nend subroutine