aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-07-08 19:38:00 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-07-08 19:43:26 +0200
commit1d35e5189ba441967cb1585c340452e6125f5ba5 (patch)
tree0d84bfafbd46da21babead143ab6e841b48683bf
parentc2275e4b9625a1a19eb50d0880f70ed583d5c358 (diff)
downloadnissy-core-1d35e5189ba441967cb1585c340452e6125f5ba5.tar.gz
nissy-core-1d35e5189ba441967cb1585c340452e6125f5ba5.zip
Added average to stats tool
-rw-r--r--tools/stats_tables_h48/stats_tables_h48.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/stats_tables_h48/stats_tables_h48.c b/tools/stats_tables_h48/stats_tables_h48.c
index 33272c1..bcc62b4 100644
--- a/tools/stats_tables_h48/stats_tables_h48.c
+++ b/tools/stats_tables_h48/stats_tables_h48.c
@@ -31,6 +31,7 @@ void run(void) {
31 int i, j, k; 31 int i, j, k;
32 char sols[12], cube[22]; 32 char sols[12], cube[22];
33 int64_t ep, eo, cp, co, v[12][100] = {0}; 33 int64_t ep, eo, cp, co, v[12][100] = {0};
34 double avg;
34 35
35 for (i = 0; i < NCUBES; i++) { 36 for (i = 0; i < NCUBES; i++) {
36 ep = rand64(); 37 ep = rand64();
@@ -48,8 +49,13 @@ void run(void) {
48 49
49 for (j = 0; j < 12; j++) { 50 for (j = 0; j < 12; j++) {
50 printf("Data for h=%d\n", j); 51 printf("Data for h=%d\n", j);
51 for (k = 0; k <= 16; k++) 52 avg = 0.0;
53 for (k = 0; k <= 16; k++) {
52 printf("%d\t%" PRId64 "\n", k, v[j][k]); 54 printf("%d\t%" PRId64 "\n", k, v[j][k]);
55 avg += v[j][k] * k;
56 }
57 avg /= (double)NCUBES;
58 printf("Average: %.4lf\n", avg);
53 printf("\n"); 59 printf("\n");
54 } 60 }
55} 61}

Generated with cgit - Back to sebastiano.tronto.net