cpp: void init_array (int n,\nDATA_TYPE POLYBENCH_2D(X,N,N,n,n),\nDATA_TYPE POLYBENCH_2D(A,N,N,n,n),\nDATA_TYPE POLYBENCH_2D(B,N,N,n,n))\n{\nint i, j;\n\nfor (i = 0; i < n; i++)\nfor (j = 0; j < n; j++)\n{\nX[i][j] = ((DATA_TYPE) i*(j+1) + 1) / n;\nA[i][j] = ((DATA_TYPE) i*(j+2) + 2) / n;\nB[i][j] = ((DATA_TYPE) i*(j+3) + 3) / n;\n}\n}
fortran: subroutine init_array(n, x, a, b)\nimplicit none\n\nDATA_TYPE, dimension(n, n) :: a\nDATA_TYPE, dimension(n, n) :: x\nDATA_TYPE, dimension(n, n) :: b\ninteger :: n\ninteger :: i, j\n\ndo i = 1, n\ndo j = 1, n\nx(j, i) = (DBLE((i - 1) * (j)) + 1.0D0) / DBLE(n)\na(j, i) = (DBLE((i - 1) * (j + 1)) + 2.0D0) / DBLE(n)\nb(j, i) = (DBLE((i - 1) * (j + 2)) + 3.0D0) / DBLE(n)\nend do\nend do\nend subroutine