aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-11-17 09:11:01 +0000
committerYann Herklotz <git@yannherklotz.com>2020-11-17 09:11:01 +0000
commit7d9057a6ca6f591851ee5c6e8d74e3833aae3903 (patch)
tree7577f9b16008a7ceb6158eb836909f1fa636dbc8 /benchmarks/polybench-syn/linear-algebra/solvers/lu.c
parent6aa7ea660f19e7bde920b5b22c1c0c93f1be2fd7 (diff)
parent38b249970456a55f0a69ff28070887367e113205 (diff)
downloadvericert-kvx-7d9057a6ca6f591851ee5c6e8d74e3833aae3903.tar.gz
vericert-kvx-7d9057a6ca6f591851ee5c6e8d74e3833aae3903.zip
Merge branch 'dev-experiments'
Diffstat (limited to 'benchmarks/polybench-syn/linear-algebra/solvers/lu.c')
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/lu.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/lu.c b/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
index d925db8..759d6ff 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
@@ -17,7 +17,11 @@
#include "../../include/misc.h"
-#define plus(n) ((n = n + 1))
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
+#define plus(i) i = i + ONE
static
void init_array (int n,
@@ -25,11 +29,14 @@ void init_array (int n,
{
int i, j;
- for (i = 0; i < n; i++) {
- for (j = 0; j <= i; j++)
- A[i][j] = (-j % n) / n + 1;
- for (j = i+1; j < n; j++) {
- A[i][j] = 0;
+ for (i = 0; i < n; plus(i))
+ {
+ for (j = 0; j <= i; plus(j))
+ A[i][j] = sdivider(smodulo(-j, n), n) + ONE;
+ for (j = i+1; j < n; plus(j)) {
+ A[i][j] = 0;
+ }
+ A[i][i] = 1;
}
A[i][i] = 1;
}
@@ -53,27 +60,6 @@ void init_array (int n,
}
-
-/*static
- void print_array(int n,
- int A[ 40 + 0][40 + 0])
-
- {
- int i, j;
-
- fprintf(stderr, "==BEGIN DUMP_ARRAYS==\n");
- fprintf(stderr, "begin dump: %s", "A");
- for (i = 0; i < n; i++)
- for (j = 0; j < n; j++) {
- if ((i * n + j) % 20 == 0) fprintf (stderr, "\n");
- fprintf (stderr, "%d ", A[i][j]);
- }
- fprintf(stderr, "\nend dump: %s\n", "A");
- fprintf(stderr, "==END DUMP_ARRAYS==\n");
- }
-*/
-
-
static
void kernel_lu(int n,
int A[ 40][40])
@@ -107,6 +93,9 @@ int check_array(int n,
for (i = 0; i < n; plus(i))
for (j = 0; j < n; plus(j))
if(A[i][j] !=0) res = 1;
+ #ifndef SYNTHESIS
+ printf("finished: %u\n", res);
+ #endif
return res;
}
@@ -123,8 +112,6 @@ int main()
init_array (n, A);
-
-
kernel_lu (n, A);
return check_array(n, A);