aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.txt35
-rw-r--r--src/solve_h48.h27
2 files changed, 48 insertions, 14 deletions
diff --git a/TODO.txt b/TODO.txt
index 397a817..d6d3699 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,11 +1,32 @@
1TODO 1Table generation: transform only edges
2 - add back benchmark, test performance of table computation 2 (cube_avx2 and cube_portable)
3 - table generation is still slow, how to improve? profile! 3 - implement compose_fast_edges and compose_fast_corners
4 selfsim could be a list of cubes (representatives) 4 - tests not needed: just base the full transform on the other two
5 - add h48 table for different values of k 5 - cube_portable: easy for compose_fast to call the other two
6 - cube_avx2: split in (EP+EO+CP) and (CO); compose_edges call
7 (EP+EO+CP), compose_corners calls the full compose
8 (cube_routines)
9 - refactor transform(): use big array of cubes instead of switch
10 - add transform_edges and transform_corners
11 (solve_h48)
12 - uncomment transform_edges() and transform_corners()
6 13
7TODO checkdata (available from cube.h) and hash check for cocsep 14Solver
8TODO benchmarks for solve and table generation 15 - write a solver (how many tricks? some, but not all are needed)
16
17More utilities for tables (in cube.h)
18 - a "dryrun" function that only tells you the size needed
19 - check hash of generated data
20
21Goal: find out which k value is best
22 - temporarily call current table and solver "k4" instead of h48
23 - write table generation and solver for k2 and k1
24 - benchmark for different sizes!
25
26Refactoring
27 - remove cube type and some low-level utilities from interface,
28 rename cube_fast_t to cube_t
29 - add b64 i/o format, base64 encoded cube, one 6-bit word per piece
9 30
10## H48 optimal solver (some has already been implemented) 31## H48 optimal solver (some has already been implemented)
11 32
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
51coord_h48(cube_fast_t c, const uint32_t *cocsepdata, uint8_t h) 52coord_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
69coord_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
76This function does not necessarily return a cube whose coordinate is 83This function does not necessarily return a cube whose coordinate is
77the given value, because it works up to symmetry. This means that the 84the given value, because it works up to symmetry. This means that the
78returned cube is a transformed cube of one that gives the correct value. 85returned 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);

Generated with cgit - Back to sebastiano.tronto.net