cpp: void init_array(int ni, int nj,\nDATA_TYPE *alpha,\nDATA_TYPE *beta,\nDATA_TYPE POLYBENCH_2D(C,NI,NI,ni,ni),\nDATA_TYPE POLYBENCH_2D(A,NI,NJ,ni,nj))\n{\nint i, j;\n\n*alpha = 32412;\n*beta = 2123;\nfor (i = 0; i < ni; i++)\nfor (j = 0; j < nj; j++)\nA[i][j] = ((DATA_TYPE) i*j) / ni;\nfor (i = 0; i < ni; i++)\nfor (j = 0; j < ni; j++)\nC[i][j] = ((DATA_TYPE) i*j) / ni;\n}
fortran: subroutine init_array(ni, nj, alpha, beta, c, a)\nimplicit none\n\nDATA_TYPE, dimension(ni, ni) :: a\nDATA_TYPE, dimension(nj, ni) :: c\nDATA_TYPE :: alpha , beta\ninteger :: nj, ni\ninteger :: i, j\n\nalpha = 32412\nbeta = 2123\n\ndo i = 1, ni\ndo j = 1, nj\na(j, i) = (DBLE(i - 1) * DBLE(j - 1)) / DBLE(ni)\nend do\ndo j = 1, ni\nc(j, i) = ((DBLE(i - 1) * DBLE(j - 1))) / DBLE(ni)\nend do\nend do\nend subroutine