aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/coord/gendata.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers/coord/gendata.h')
-rw-r--r--src/solvers/coord/gendata.h54
1 files changed, 41 insertions, 13 deletions
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h
index ca058b0..5e40575 100644
--- a/src/solvers/coord/gendata.h
+++ b/src/solvers/coord/gendata.h
@@ -2,6 +2,8 @@ STATIC size_t gendata_coord(const coord_t [static 1], void *);
2STATIC int64_t gendata_coord_dispatch(const char *, void *); 2STATIC int64_t gendata_coord_dispatch(const char *, void *);
3STATIC tableinfo_t genptable_coord( 3STATIC tableinfo_t genptable_coord(
4 const coord_t [static 1], const void *, uint8_t *); 4 const coord_t [static 1], const void *, uint8_t *);
5STATIC uint64_t genptable_coord_fillneighbors(
6 const coord_t [static 1], const void *, uint64_t, uint8_t, uint8_t *);
5STATIC void getdistribution_coord( 7STATIC void getdistribution_coord(
6 const uint8_t *, const char *, uint64_t [static INFO_DISTRIBUTION_LEN]); 8 const uint8_t *, const char *, uint64_t [static INFO_DISTRIBUTION_LEN]);
7STATIC uint8_t get_coord_pval( 9STATIC uint8_t get_coord_pval(
@@ -81,10 +83,8 @@ genptable_coord(
81 uint8_t *table 83 uint8_t *table
82) 84)
83{ 85{
84 uint64_t tablesize, i, j, d, tot; 86 uint64_t tablesize, i, d, tot, t;
85 tableinfo_t info; 87 tableinfo_t info;
86 uint8_t m;
87 cube_t c, cc;
88 88
89 tablesize = DIV_ROUND_UP(coord->max, 2); 89 tablesize = DIV_ROUND_UP(coord->max, 2);
90 90
@@ -113,24 +113,52 @@ genptable_coord(
113 for (d = 1, tot = 1; tot < coord->max; d++) { 113 for (d = 1, tot = 1; tot < coord->max; d++) {
114 for (i = 0; i < coord->max; i++) { 114 for (i = 0; i < coord->max; i++) {
115 if (get_coord_pval(coord, table, i) == d-1) { 115 if (get_coord_pval(coord, table, i) == d-1) {
116 c = coord->cube(i, data); 116 t = genptable_coord_fillneighbors(
117 for (m = 0; m < 18; m++) { 117 coord, data, i, d, table);
118 cc = move(c, m); 118 tot += t;
119 j = coord->coord(cc, data); 119 info.distribution[d] += t;
120 if (get_coord_pval(coord, table, j) > d) {
121 set_coord_pval(coord, table, j, d);
122 tot++;
123 info.distribution[d]++;
124 }
125 }
126 } 120 }
127 } 121 }
122 LOG("Depth %" PRIu64 ": %" PRIu64 " of %" PRIu64 "\n",
123 d, tot, coord->max);
128 } 124 }
129 info.maxvalue = d-1; 125 info.maxvalue = d-1;
130 126
131 return info; 127 return info;
132} 128}
133 129
130STATIC uint64_t
131genptable_coord_fillneighbors(
132 const coord_t coord[static 1],
133 const void *data,
134 uint64_t i,
135 uint8_t d,
136 uint8_t *table
137)
138{
139 uint8_t m;
140 uint64_t j, t, tot;
141 cube_t c, moved;
142
143 c = coord->cube(i, data);
144 tot = 0;
145 for (m = 0; m < NMOVES; m++) {
146 moved = move(c, m);
147 for (t = 0; t < NTRANS; t++) {
148 if (!((UINT64_C(1) << t) & coord->trans_mask))
149 continue;
150
151 j = coord->coord(transform(moved, t), data);
152 if (get_coord_pval(coord, table, j) > d) {
153 set_coord_pval(coord, table, j, d);
154 tot++;
155 }
156 }
157 }
158
159 return tot;
160}
161
134STATIC void 162STATIC void
135getdistribution_coord( 163getdistribution_coord(
136 const uint8_t *table, 164 const uint8_t *table,

Generated with cgit - Back to sebastiano.tronto.net