1
2 const int N_r = 56;
3 const int N_c = 75;
4
5 const int TILE_DIM = 16;
6
7 const int outer_Dimc = (N_c - 1) / TILE_DIM + 1;
8 const int outer_Dimr = (N_r - 1) / TILE_DIM + 1;
9
10 int** dest;
11 int** src;
12
13//
14 // (0) Outer loops to iterate over tiles
15 //
16 for (int by = 0; by < outer_Dimr; ++by) {
17 for (int bx = 0; bx < outer_Dimc; ++bx) {
18 //
19 // (1) Loops to iterate over tile entries
20 //
21 for (int ty = 0; ty < TILE_DIM; ++ty) {
22 for (int tx = 0; tx < TILE_DIM; ++tx) {
23
24 int col = bx * TILE_DIM + tx; // Matrix column index
25 int row = by * TILE_DIM + ty; // Matrix row index
26
27 // Bounds check
28 if (row < N_r && col < N_c) {
29 dest[col][row] = src[row][col];
30 }
31
32 }
33 }
34
35 }
36 }