cpp: void init_array(int ni,\nDATA_TYPE *alpha,\nDATA_TYPE POLYBENCH_2D(A,NI,NI,ni,ni),\nDATA_TYPE POLYBENCH_2D(B,NI,NI,ni,ni))\n{\nint i, j;\n\n*alpha = 32412;\nfor (i = 0; i < ni; i++)\nfor (j = 0; j < ni; j++) {\nA[i][j] = ((DATA_TYPE) i*j) / ni;\nB[i][j] = ((DATA_TYPE) i*j) / ni;\n}\n}
fortran: subroutine init_array(n, alpha, a, b)\nimplicit none\n\nDATA_TYPE, dimension(n, n) :: a\nDATA_TYPE, dimension(n, n) :: b\nDATA_TYPE :: alpha\ninteger :: n\ninteger :: i, j\n\nalpha = 32412D0\ndo i = 1, n\ndo j = 1, n\na(j, i) = (DBLE(i - 1) * DBLE(j - 1)) / DBLE(n)\nb(j, i) = ((DBLE(i - 1) * DBLE(j - 1))) / DBLE(n)\nend do\nend do\nend subroutine