push affine conditions into index expressions
[pet.git] / tests / QR.c
bloba0e2e628ae7b6e33b40fa7dc19e9c57c2aa4ca9d
1 int Zero();
2 int ReadMatrix();
3 void Vectorize(int, int, int *, int *, int *);
4 void Rotate(int, int, int, int *, int *, int *);
5 void WriteMatrix(int);
7 int N, K = 256;
8 #pragma parameter N 8 16
9 #pragma parameter K 100 1000
11 int main(void)
13 int j, i, k;
14 int R[N][N], X[K][N], t;
16 #pragma scop
17 for (j = 0; j < N; ++j)
18 for (i = j; i < N; ++i)
19 R[j][i] = Zero();
21 for (k = 0; k < K; ++k)
22 for (j = 0; j < N; ++j)
23 X[k][j] = ReadMatrix();
25 for (k = 0; k < K; ++k)
26 for (j = 0; j < N; ++j) {
27 Vectorize(R[j][j], X[k][j], &R[j][j], &X[k][j], &t);
28 for (i = j+1; i < N; ++i)
29 Rotate(R[j][i], X[k][i], t, &R[j][i], &X[k][i], &t);
32 for (j = 0; j < N; ++j)
33 for (i = j; i < N; ++i)
34 WriteMatrix(R[j][i]);
35 #pragma endscop