cpp: void init_array(int maxgrid,\nDATA_TYPE POLYBENCH_2D(sum_tang,MAXGRID,MAXGRID,maxgrid,maxgrid),\nDATA_TYPE POLYBENCH_2D(mean,MAXGRID,MAXGRID,maxgrid,maxgrid),\nDATA_TYPE POLYBENCH_2D(path,MAXGRID,MAXGRID,maxgrid,maxgrid))\n{\nint i, j;\n\nfor (i = 0; i < maxgrid; i++)\nfor (j = 0; j < maxgrid; j++) {\nsum_tang[i][j] = (DATA_TYPE)((i+1)*(j+1));\nmean[i][j] = ((DATA_TYPE) i-j) / maxgrid;\npath[i][j] = ((DATA_TYPE) i*(j-1)) / maxgrid;\n}\n}
fortran: subroutine init_array(maxgrid, sumTang, mean, path)\nimplicit none\n\ninteger :: maxgrid\nDATA_TYPE, dimension (maxgrid, maxgrid) :: sumTang, mean, path\ninteger :: i, j\ndo i = 1, maxgrid\ndo j = 1, maxgrid\nsumTang(j, i) = i * j\nmean(j, i) = ( i - j ) / (maxgrid)\npath(j, i) = (( i - 1 ) * ( j - 2 )) / (maxgrid)\nend do\nend do\nend subroutine