cpp: void init_array(int n,\nDATA_TYPE POLYBENCH_1D(x1,N,n),\nDATA_TYPE POLYBENCH_1D(x2,N,n),\nDATA_TYPE POLYBENCH_1D(y_1,N,n),\nDATA_TYPE POLYBENCH_1D(y_2,N,n),\nDATA_TYPE POLYBENCH_2D(A,N,N,n,n))\n{\nint i, j;\n\nfor (i = 0; i < n; i++)\n{\nx1[i] = ((DATA_TYPE) i) / n;\nx2[i] = ((DATA_TYPE) i + 1) / n;\ny_1[i] = ((DATA_TYPE) i + 3) / n;\ny_2[i] = ((DATA_TYPE) i + 4) / n;\nfor (j = 0; j < n; j++)\nA[i][j] = ((DATA_TYPE) i*j) / N;\n}\n}
fortran: subroutine init_array(n, x1, x2, y1, y2, a)\nimplicit none\n\nDATA_TYPE, dimension(n, n) :: a\nDATA_TYPE, dimension(n) :: x1\nDATA_TYPE, dimension(n) :: y1\nDATA_TYPE, dimension(n) :: x2\nDATA_TYPE, dimension(n) :: y2\ninteger :: n\ninteger :: i, j\n\ndo i = 1, n\nx1(i) = DBLE(i - 1) / DBLE(n)\nx2(i) = (DBLE(i - 1) + 1.0D0) / DBLE(n)\ny1(i) = (DBLE(i - 1) + 3.0D0) / DBLE(n)\ny2(i) = (DBLE(i - 1) + 4.0D0) / DBLE(n)\ndo j = 1, n\na(j, i) = ((DBLE(i - 1) * DBLE(j - 1))) / DBLE(n)\nend do\nend do\nend subroutine