diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-14 21:28:37 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-14 21:28:37 +0200 |
| commit | 61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7 (patch) | |
| tree | a7a6edc2e44689ed62472bdece1d9bf6a300419f /src | |
| parent | a016aa7f78c86c59bab3ae4970f8cc339186bc91 (diff) | |
| download | nissy-core-61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7.tar.gz nissy-core-61e03f9f4eecf3d5811b11c44c9ef778f0a93bc7.zip | |
Found a sneaky bug (it's all a mess now)
Diffstat (limited to 'src')
| -rw-r--r-- | src/solve_h48.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/src/solve_h48.h b/src/solve_h48.h index 26cbc73..c3316e1 100644 --- a/src/solve_h48.h +++ b/src/solve_h48.h | |||
| @@ -244,7 +244,7 @@ invcoord_h48(int64_t i, const cube_t *crep, uint8_t h) | |||
| 244 | /* | 244 | /* |
| 245 | Each element of the cocsep table is a uint32_t used as follows: | 245 | Each element of the cocsep table is a uint32_t used as follows: |
| 246 | - Lowest 8-bit block: pruning value | 246 | - Lowest 8-bit block: pruning value |
| 247 | - Second-lower 8-bit block: "ttrep" (transformation to representative) | 247 | - Second-lowest 8-bit block: "ttrep" (transformation to representative) |
| 248 | - Top 16-bit block: symcoord value | 248 | - Top 16-bit block: symcoord value |
| 249 | After the data as described above, more auxiliary information is appended: | 249 | After the data as described above, more auxiliary information is appended: |
| 250 | - A uint32_t representing the number of symmetry classes | 250 | - A uint32_t representing the number of symmetry classes |
| @@ -331,7 +331,7 @@ gendata_cocsep_dfs(dfsarg_cocsep_t *arg) | |||
| 331 | if (arg->selfsim != NULL) | 331 | if (arg->selfsim != NULL) |
| 332 | arg->selfsim[*arg->n] |= is << t; | 332 | arg->selfsim[*arg->n] |= is << t; |
| 333 | set_visited(arg->visited, j); | 333 | set_visited(arg->visited, j); |
| 334 | tinv = inverse_trans(t); | 334 | tinv = inverse_trans(t) * (1-is); |
| 335 | olddepth = (uint8_t)(arg->buf32[j] & 0xFF); | 335 | olddepth = (uint8_t)(arg->buf32[j] & 0xFF); |
| 336 | cc += olddepth == 0xFF; | 336 | cc += olddepth == 0xFF; |
| 337 | 337 | ||
| @@ -425,13 +425,12 @@ gendata_h48h0k4_bfs(bfsarg_esep_t *arg) | |||
| 425 | TODO: the new method gives a slightly different answer. If the new | 425 | TODO: the new method gives a slightly different answer. If the new |
| 426 | method is correct, then the old bfs method is wrong. Which one is it? | 426 | method is correct, then the old bfs method is wrong. Which one is it? |
| 427 | Try also DFS and compare results (it could be faster). | 427 | Try also DFS and compare results (it could be faster). |
| 428 | /* | 428 | */ |
| 429 | if (2 * arg->done < (int64_t)ESEP_MAX(0)) | 429 | if (2 * arg->done < (int64_t)ESEP_MAX(0)) |
| 430 | return gendata_h48h0k4_bfs_fromdone(arg); | 430 | return gendata_h48h0k4_bfs_fromdone(arg); |
| 431 | else | 431 | else |
| 432 | return gendata_h48h0k4_bfs_fromnew(arg); | 432 | return gendata_h48h0k4_bfs_fromnew(arg); |
| 433 | */ | 433 | // return gendata_h48h0k4_bfs_fromnew(arg); |
| 434 | return gendata_h48h0k4_bfs_fromdone(arg); | ||
| 435 | } | 434 | } |
| 436 | 435 | ||
| 437 | _static int64_t | 436 | _static int64_t |
| @@ -439,7 +438,8 @@ gendata_h48h0k4_bfs_fromdone(bfsarg_esep_t *arg) | |||
| 439 | { | 438 | { |
| 440 | uint8_t c, m, x; | 439 | uint8_t c, m, x; |
| 441 | uint32_t cc; | 440 | uint32_t cc; |
| 442 | int64_t i, j, k, t, cocsep_coord, sim; | 441 | int64_t i, j, k, t, cocsep_coord; |
| 442 | uint64_t sim; | ||
| 443 | cube_t cube, moved, transd; | 443 | cube_t cube, moved, transd; |
| 444 | 444 | ||
| 445 | for (i = 0, cc = 0; i < (int64_t)ESEP_MAX(0); i++) { | 445 | for (i = 0, cc = 0; i < (int64_t)ESEP_MAX(0); i++) { |
| @@ -461,10 +461,29 @@ gendata_h48h0k4_bfs_fromdone(bfsarg_esep_t *arg) | |||
| 461 | set_esep_pval(arg->buf32, j, arg->depth); | 461 | set_esep_pval(arg->buf32, j, arg->depth); |
| 462 | cc += x != arg->depth; | 462 | cc += x != arg->depth; |
| 463 | cocsep_coord = j / H48_ESIZE(0); | 463 | cocsep_coord = j / H48_ESIZE(0); |
| 464 | sim = arg->selfsim[cocsep_coord] >> 1; | 464 | sim = arg->selfsim[cocsep_coord] >> UINT64_C(1); |
| 465 | for (t = 1; t < 48 && sim; t++, sim >>= 1) { | 465 | for (t = 1; t < 48 && sim; t++, sim >>= UINT64_C(1)) { |
| 466 | if (!(sim & 1)) | 466 | if (!(sim & UINT64_C(1))) { |
| 467 | transd = transform(moved, t); | ||
| 468 | k = coord_h48(transd, arg->cocsepdata, 0); | ||
| 469 | if (k != j) { | ||
| 470 | LOG("t=%" PRId64 ", tinv=%" PRIu8 "\n", t, inverse_trans(t)); | ||
| 471 | int64_t ccm = coord_cocsep(moved); | ||
| 472 | int64_t repm = coord_cocsep(arg->crep[j/H48_ESIZE(0)]); | ||
| 473 | LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, ccm, repm, TTREP(arg->cocsepdata[ccm])); | ||
| 474 | int64_t cct = coord_cocsep(transd); | ||
| 475 | int64_t rept = coord_cocsep(arg->crep[k/H48_ESIZE(0)]); | ||
| 476 | LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, cct, rept, TTREP(arg->cocsepdata[cct])); | ||
| 477 | /* | ||
| 478 | char q[150]; | ||
| 479 | writecube_H48(moved, q); | ||
| 480 | LOG("%s\n", q) | ||
| 481 | writecube_H48(transd, q); | ||
| 482 | LOG("%s\n", q) | ||
| 483 | */ | ||
| 484 | } | ||
| 467 | continue; | 485 | continue; |
| 486 | } | ||
| 468 | transd = transform(moved, t); | 487 | transd = transform(moved, t); |
| 469 | k = coord_h48(transd, arg->cocsepdata, 0); | 488 | k = coord_h48(transd, arg->cocsepdata, 0); |
| 470 | x = get_esep_pval(arg->buf32, k); | 489 | x = get_esep_pval(arg->buf32, k); |
| @@ -497,7 +516,10 @@ gendata_h48h0k4_bfs_fromnew(bfsarg_esep_t *arg) | |||
| 497 | j = coord_h48(moved, arg->cocsepdata, 0); | 516 | j = coord_h48(moved, arg->cocsepdata, 0); |
| 498 | x = get_esep_pval(arg->buf32, j); | 517 | x = get_esep_pval(arg->buf32, j); |
| 499 | if (x < arg->depth) | 518 | if (x < arg->depth) |
| 519 | { | ||
| 520 | if (x < arg->depth -1) LOG("WAT %" PRIu8 " while scanning %" PRIu8 "\n",x, arg->depth); | ||
| 500 | goto neighbor_found; | 521 | goto neighbor_found; |
| 522 | } | ||
| 501 | } | 523 | } |
| 502 | continue; | 524 | continue; |
| 503 | neighbor_found: | 525 | neighbor_found: |
