diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/solve_h48.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/solve_h48.h b/src/solve_h48.h index be2c328..14c114a 100644 --- a/src/solve_h48.h +++ b/src/solve_h48.h | |||
| @@ -35,6 +35,7 @@ typedef struct { | |||
| 35 | } bfsarg_esep_t; | 35 | } bfsarg_esep_t; |
| 36 | 36 | ||
| 37 | _static_inline int64_t coord_h48(cube_fast_t, const uint32_t *, uint8_t); | 37 | _static_inline int64_t coord_h48(cube_fast_t, const uint32_t *, uint8_t); |
| 38 | _static_inline int64_t coord_h48_edges(cube_fast_t, int64_t, uint8_t, uint8_t); | ||
| 38 | _static_inline cube_fast_t invcoord_h48(int64_t, const cube_fast_t *, uint8_t); | 39 | _static_inline cube_fast_t invcoord_h48(int64_t, const cube_fast_t *, uint8_t); |
| 39 | 40 | ||
| 40 | _static size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); | 41 | _static size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); |
| @@ -50,8 +51,7 @@ _static_inline void set_esep_pval(uint32_t *, int64_t, uint8_t); | |||
| 50 | _static_inline int64_t | 51 | _static_inline int64_t |
| 51 | coord_h48(cube_fast_t c, const uint32_t *cocsepdata, uint8_t h) | 52 | coord_h48(cube_fast_t c, const uint32_t *cocsepdata, uint8_t h) |
| 52 | { | 53 | { |
| 53 | cube_fast_t d; | 54 | int64_t cocsep, coclass; |
| 54 | int64_t cocsep, coclass, esep, eo, ret; | ||
| 55 | uint32_t data; | 55 | uint32_t data; |
| 56 | uint8_t ttrep; | 56 | uint8_t ttrep; |
| 57 | 57 | ||
| @@ -62,17 +62,24 @@ coord_h48(cube_fast_t c, const uint32_t *cocsepdata, uint8_t h) | |||
| 62 | coclass = (data & (0xFFFFU << 16U)) >> 16U; | 62 | coclass = (data & (0xFFFFU << 16U)) >> 16U; |
| 63 | ttrep = (data & (0xFFU << 8U)) >> 8U; | 63 | ttrep = (data & (0xFFU << 8U)) >> 8U; |
| 64 | 64 | ||
| 65 | d = transform(c, ttrep); /* TODO: transform only edges */ | 65 | return coord_h48_edges(c, coclass, ttrep, h); |
| 66 | } | ||
| 67 | |||
| 68 | _static_inline int64_t | ||
| 69 | coord_h48_edges(cube_fast_t c, int64_t coclass, uint8_t t, uint8_t h) | ||
| 70 | { | ||
| 71 | cube_fast_t d; | ||
| 72 | int64_t esep, eo; | ||
| 73 | |||
| 74 | //d = transform_edges(c, t); | ||
| 75 | d = transform(c, t); | ||
| 66 | esep = coord_fast_esep(d); | 76 | esep = coord_fast_esep(d); |
| 67 | eo = coord_fast_eo(d); | 77 | eo = coord_fast_eo(d); |
| 68 | 78 | ||
| 69 | ret = (coclass * H48_ESIZE(h)) + (esep << h) + (eo >> (11-h)); | 79 | return (coclass * H48_ESIZE(h)) + (esep << h) + (eo >> (11-h)); |
| 70 | |||
| 71 | return ret; | ||
| 72 | } | 80 | } |
| 73 | 81 | ||
| 74 | /* | 82 | /* |
| 75 | |||
| 76 | This function does not necessarily return a cube whose coordinate is | 83 | This function does not necessarily return a cube whose coordinate is |
| 77 | the given value, because it works up to symmetry. This means that the | 84 | the given value, because it works up to symmetry. This means that the |
| 78 | returned cube is a transformed cube of one that gives the correct value. | 85 | returned cube is a transformed cube of one that gives the correct value. |
| @@ -174,6 +181,7 @@ gendata_cocsep_dfs(dfsarg_cocsep_t *arg) | |||
| 174 | return 0; | 181 | return 0; |
| 175 | 182 | ||
| 176 | for (t = 0, cc = 0; t < 48; t++) { | 183 | for (t = 0, cc = 0; t < 48; t++) { |
| 184 | //d = transform_corners(arg->cube, t); | ||
| 177 | d = transform(arg->cube, t); | 185 | d = transform(arg->cube, t); |
| 178 | ii = coord_fast_cocsep(d); | 186 | ii = coord_fast_cocsep(d); |
| 179 | arg->selfsim[*arg->n] |= (i == ii) << t; | 187 | arg->selfsim[*arg->n] |= (i == ii) << t; |
| @@ -267,6 +275,11 @@ gendata_esep_bfs(bfsarg_esep_t *arg) | |||
| 267 | continue; | 275 | continue; |
| 268 | cube = invcoord_h48(i, arg->crep, arg->h); | 276 | cube = invcoord_h48(i, arg->crep, arg->h); |
| 269 | for (m = 0; m < 18; m++) { | 277 | for (m = 0; m < 18; m++) { |
| 278 | /* | ||
| 279 | * TODO: here we can optimize by computing at first | ||
| 280 | * only the corner part of the coordinate, and then | ||
| 281 | * the edge parts for each transformation. | ||
| 282 | */ | ||
| 270 | moved = move(cube, m); | 283 | moved = move(cube, m); |
| 271 | j = coord_h48(moved, arg->cocsepdata, arg->h); | 284 | j = coord_h48(moved, arg->cocsepdata, arg->h); |
| 272 | x = get_esep_pval(arg->buf32, j); | 285 | x = get_esep_pval(arg->buf32, j); |
