1#include <stdio.h>
2
3#define N 1536
4float A[N][N];
5float B[N][N];
6float C[N][N];
7
8void init_array()
9{
10 int i, j;
11
12 for (i = 0; i < N; i++) {
13 for (j = 0; j < N; j++) {
14 A[i][j] = (1+(i*j)%1024)/2.0;
15 B[i][j] = (1+(i*j)%1024)/2.0;
16 }
17 }
18}
19
20void print_array()
21{
22 int i, j;
23
24 for (i = 0; i < N; i++) {
25 for (j = 0; j < N; j++) {
26 fprintf(stdout, format: "%lf ", C[i][j]);
27 if (j%80 == 79) fprintf(stdout, format: "\n");
28 }
29 fprintf(stdout, format: "\n");
30 }
31}
32
33int main()
34{
35 int i, j, k;
36 double t_start, t_end;
37
38 init_array();
39
40 for (i = 0; i < N; i++) {
41 for (j = 0; j < N; j++) {
42 C[i][j] = 0;
43 for (k = 0; k < N; k++)
44 C[i][j] = C[i][j] + A[i][k] * B[k][j];
45 }
46 }
47
48#ifdef TEST
49 print_array();
50#endif
51 return 0;
52}
53

source code of polly/docs/experiments/matmul/matmul.c