aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/gendata_h48.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-08-30 07:52:53 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-08-30 07:52:53 +0200
commitc548499e68e473452592c9b0bf860f76bd8b94b8 (patch)
tree02219807113dde108e278f38f3dd5874f7e3dc18 /src/solvers/h48/gendata_h48.h
parent7e6c14a2f6e9e9cbac3431f3085c42bbe474d13d (diff)
downloadnissy-core-c548499e68e473452592c9b0bf860f76bd8b94b8.tar.gz
nissy-core-c548499e68e473452592c9b0bf860f76bd8b94b8.zip
Added tool for checking new tables (and they are wrong)
Diffstat (limited to 'src/solvers/h48/gendata_h48.h')
-rw-r--r--src/solvers/h48/gendata_h48.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
index c421c27..fbb8b35 100644
--- a/src/solvers/h48/gendata_h48.h
+++ b/src/solvers/h48/gendata_h48.h
@@ -1,6 +1,7 @@
1#define H48_COORDMAX_NOEO ((int64_t)(COCSEP_CLASSES * _12c4 * _8c4)) 1#define H48_COORDMAX_NOEO ((int64_t)(COCSEP_CLASSES * _12c4 * _8c4))
2#define H48_COORDMAX(h) ((int64_t)(H48_COORDMAX_NOEO << (int64_t)(h))) 2#define H48_COORDMAX(h) ((int64_t)(H48_COORDMAX_NOEO << (int64_t)(h)))
3#define H48_TABLESIZE(h, k) ((size_t)H48_COORDMAX((h)) / ((size_t)8 / (size_t)(k))) 3#define H48_DIV(k) ((size_t)8 / (size_t)(k))
4#define H48_TABLESIZE(h, k) _div_round_up((size_t)H48_COORDMAX((h)), H48_DIV(k))
4 5
5#define H48_COEFF(k) (UINT32_C(32) / (uint32_t)(k)) 6#define H48_COEFF(k) (UINT32_C(32) / (uint32_t)(k))
6#define H48_INDEX(i, k) ((uint32_t)(i) / H48_COEFF(k)) 7#define H48_INDEX(i, k) ((uint32_t)(i) / H48_COEFF(k))
@@ -140,7 +141,7 @@ gendata_h48(gendata_h48_arg_t *arg)
140 cocsepsize = gendata_cocsep( 141 cocsepsize = gendata_cocsep(
141 (void *)arg->cocsepdata, arg->selfsim, arg->crep); 142 (void *)arg->cocsepdata, arg->selfsim, arg->crep);
142 arg->h48data = arg->cocsepdata + (cocsepsize / sizeof(uint32_t)); 143 arg->h48data = arg->cocsepdata + (cocsepsize / sizeof(uint32_t));
143 arg->info = arg->h48data + 144 arg->info = arg->h48data + 1 +
144 (H48_TABLESIZE(arg->h, arg->k) / sizeof(uint32_t)); 145 (H48_TABLESIZE(arg->h, arg->k) / sizeof(uint32_t));
145 146
146 if (arg->buf != NULL) 147 if (arg->buf != NULL)
@@ -341,18 +342,27 @@ gendata_h48k2(gendata_h48_arg_t *arg)
341 }; 342 };
342 343
343 i = 0; 344 i = 0;
345int jj = 0;
344 for (kv = h48map_nextkvpair(&shortcubes, &i); 346 for (kv = h48map_nextkvpair(&shortcubes, &i);
345 i != shortcubes.capacity; 347 i != shortcubes.capacity;
346 kv = h48map_nextkvpair(&shortcubes, &i) 348 kv = h48map_nextkvpair(&shortcubes, &i)
347 ) { 349 ) {
348 /* TODO maybe over all sim? */
349 dfsarg.cube = invcoord_h48(kv.key, arg->crep, 11); 350 dfsarg.cube = invcoord_h48(kv.key, arg->crep, 11);
351
352#if 1
350 gendata_h48k2_dfs(&dfsarg); 353 gendata_h48k2_dfs(&dfsarg);
354#else
355 /* It looks like this is not necessary, we get the same result */
356 _foreach_h48sim(
357 dfsarg.cube, arg->cocsepdata, arg->selfsim, arg->h,
358 gendata_h48k2_dfs(&dfsarg);
359 )
360#endif
361if ((++jj) % 1000 == 0) LOG("Done %d distance 8 cubes\n", jj);
351 } 362 }
352 363
353 h48map_destroy(&shortcubes); 364 h48map_destroy(&shortcubes);
354 365
355 /* TODO: move info update to dfs? */
356 memset(arg->info, 0, 5 * sizeof(arg->info[0])); 366 memset(arg->info, 0, 5 * sizeof(arg->info[0]));
357 arg->info[0] = base[arg->k]; 367 arg->info[0] = base[arg->k];
358 for (j = 0; j < H48_COORDMAX(arg->h); j++) { 368 for (j = 0; j < H48_COORDMAX(arg->h); j++) {
@@ -384,8 +394,7 @@ gendata_h48k2_dfs(h48k2_dfs_arg_t *arg)
384 set_esep_pval(arg->h48data, coord, arg->k, newval); 394 set_esep_pval(arg->h48data, coord, arg->k, newval);
385 } 395 }
386 396
387 if ((val < arg->shortdepth) || 397 if ((arg->depth > arg->shortdepth && val != MAP_UNSET_VAL) ||
388 (arg->depth > arg->shortdepth && val != MAP_UNSET) ||
389 (arg->depth >= arg->maxdepth || arg->depth >= arg->base + 2)) 398 (arg->depth >= arg->maxdepth || arg->depth >= arg->base + 2))
390 return; 399 return;
391 400

Generated with cgit - Back to sebastiano.tronto.net