aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-05-17 19:45:11 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-05-17 19:45:11 +0200
commit869d852bd7bf0531af4605773615c0bf0c911d48 (patch)
tree1d78c2fd217f86a81b1e7f6143922ca2e9c9ab01
parent1809d7b212128fcdcb481002a17db5dc97a15e03 (diff)
downloadnissy-core-869d852bd7bf0531af4605773615c0bf0c911d48.tar.gz
nissy-core-869d852bd7bf0531af4605773615c0bf0c911d48.zip
Prepare for next step
-rw-r--r--TODO.txt2
-rw-r--r--src/cube_avx2.h8
-rw-r--r--src/cube_portable.h8
-rw-r--r--src/solve_h48.h13
-rw-r--r--test/078_invcoord_esep/00_solved.in1
-rw-r--r--test/078_invcoord_esep/00_solved.out1
-rw-r--r--test/078_invcoord_esep/01_U.in1
-rw-r--r--test/078_invcoord_esep/01_U.out1
-rw-r--r--test/078_invcoord_esep/02_U2.in1
-rw-r--r--test/078_invcoord_esep/02_U2.out1
-rw-r--r--test/078_invcoord_esep/20_scrambled.in3
-rw-r--r--test/078_invcoord_esep/20_scrambled.out1
-rw-r--r--test/078_invcoord_esep/21_swapaxis_FB.in1
-rw-r--r--test/078_invcoord_esep/21_swapaxis_FB.out1
-rw-r--r--test/078_invcoord_esep/22_swapaxis_RL.in1
-rw-r--r--test/078_invcoord_esep/22_swapaxis_RL.out1
-rw-r--r--test/078_invcoord_esep/23_swapaxis_UD.in1
-rw-r--r--test/078_invcoord_esep/23_swapaxis_UD.out1
-rw-r--r--test/078_invcoord_esep/invcoord_esep_tests.c24
19 files changed, 60 insertions, 11 deletions
diff --git a/TODO.txt b/TODO.txt
index 5441a9f..affddec 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,8 +1,8 @@
1In progress: go back to nissy-style BFS for eosep data computation 1In progress: go back to nissy-style BFS for eosep data computation
2 - (done) compute selfsim and cocsep representatives 2 - (done) compute selfsim and cocsep representatives
3 - (done) implement set_eo_fast for invcoord_h48 3 - (done) implement set_eo_fast for invcoord_h48
4 - for invcoord_h48 remove erep, implement inverse esep coord
4 - add unit tests for invcoord_h48 (compute tables, if needed) 5 - add unit tests for invcoord_h48 (compute tables, if needed)
5 - in gendata_esep, compute representatives for esep inverse coordinate
6 - change to BFS 6 - change to BFS
7 7
8TODO pruning tables: 8TODO pruning tables:
diff --git a/src/cube_avx2.h b/src/cube_avx2.h
index 8d1c940..30b0c0f 100644
--- a/src/cube_avx2.h
+++ b/src/cube_avx2.h
@@ -28,6 +28,7 @@ _static_inline int64_t coord_fast_esep(cube_fast_t);
28_static_inline void copy_corners_fast(cube_fast_t *, cube_fast_t); 28_static_inline void copy_corners_fast(cube_fast_t *, cube_fast_t);
29_static_inline void copy_edges_fast(cube_fast_t *, cube_fast_t); 29_static_inline void copy_edges_fast(cube_fast_t *, cube_fast_t);
30_static_inline void set_eo_fast(cube_fast_t *, int64_t); 30_static_inline void set_eo_fast(cube_fast_t *, int64_t);
31_static_inline cube_fast_t invcoord_fast_esep(int64_t);
31 32
32_static_inline cube_fast_t 33_static_inline cube_fast_t
33fastcube( 34fastcube(
@@ -268,3 +269,10 @@ set_eo_fast(cube_fast_t *cube, int64_t eo)
268 *cube = _mm256_andnot_si256(_eo_avx2, *cube); 269 *cube = _mm256_andnot_si256(_eo_avx2, *cube);
269 *cube = _mm256_or_si256(*cube, veo); 270 *cube = _mm256_or_si256(*cube, veo);
270} 271}
272
273_static_inline cube_fast_t
274invcoord_fast_esep(int64_t esep)
275{
276 /* TODO */
277 return cubetofast(zero);
278}
diff --git a/src/cube_portable.h b/src/cube_portable.h
index 125c300..24c39e8 100644
--- a/src/cube_portable.h
+++ b/src/cube_portable.h
@@ -22,6 +22,7 @@ _static_inline int64_t coord_fast_esep(cube_fast_t);
22_static_inline void copy_corners_fast(cube_fast_t *, cube_fast_t); 22_static_inline void copy_corners_fast(cube_fast_t *, cube_fast_t);
23_static_inline void copy_edges_fast(cube_fast_t *, cube_fast_t); 23_static_inline void copy_edges_fast(cube_fast_t *, cube_fast_t);
24_static_inline void set_eo_fast(cube_fast_t *, int64_t); 24_static_inline void set_eo_fast(cube_fast_t *, int64_t);
25_static_inline cube_fast_t invcoord_fast_esep(int64_t);
25 26
26_static_inline cube_fast_t 27_static_inline cube_fast_t
27fastcube( 28fastcube(
@@ -251,3 +252,10 @@ set_eo_fast(cube_fast_t *cube, int64_t eo)
251 } 252 }
252 cube->edge[0] = (cube->edge[0] & ~_eobit) | (_eobit * (sum%2)); 253 cube->edge[0] = (cube->edge[0] & ~_eobit) | (_eobit * (sum%2));
253} 254}
255
256_static_inline cube_fast_t
257invcoord_fast_esep(int64_t esep)
258{
259 /* TODO */
260 return cubetofast(zero);
261}
diff --git a/src/solve_h48.h b/src/solve_h48.h
index 2fe1d69..d4a018b 100644
--- a/src/solve_h48.h
+++ b/src/solve_h48.h
@@ -39,8 +39,7 @@ typedef struct {
39} dfsarg_esep_t; 39} dfsarg_esep_t;
40 40
41_static_inline int64_t coord_h48(cube_fast_t, const uint32_t *, uint8_t); 41_static_inline int64_t coord_h48(cube_fast_t, const uint32_t *, uint8_t);
42_static_inline cube_fast_t invcoord_h48(int64_t, const uint32_t *, 42_static_inline cube_fast_t invcoord_h48(int64_t, const cube_fast_t *, uint8_t);
43 const cube_fast_t *, const cube_fast_t *, uint8_t);
44 43
45_static size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); 44_static size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *);
46_static uint32_t gendata_cocsep_dfs(dfsarg_cocsep_t *); 45_static uint32_t gendata_cocsep_dfs(dfsarg_cocsep_t *);
@@ -77,13 +76,7 @@ coord_h48(cube_fast_t c, const uint32_t *cocsepdata, uint8_t h)
77} 76}
78 77
79_static_inline cube_fast_t 78_static_inline cube_fast_t
80invcoord_h48( 79invcoord_h48(int64_t i, const cube_fast_t *crep, uint8_t h)
81 int64_t i,
82 const uint32_t *cocsepdata,
83 const cube_fast_t *crep,
84 const cube_fast_t *erep,
85 uint8_t h
86)
87{ 80{
88 cube_fast_t ret; 81 cube_fast_t ret;
89 int64_t coclass, ee, esep, eo; 82 int64_t coclass, ee, esep, eo;
@@ -96,8 +89,8 @@ invcoord_h48(
96 esep = ee >> h; 89 esep = ee >> h;
97 eo = (ee & ((1<<h)-1)) << (11-h); 90 eo = (ee & ((1<<h)-1)) << (11-h);
98 91
92 ret = invcoord_fast_esep(esep);
99 copy_corners_fast(&ret, crep[coclass]); 93 copy_corners_fast(&ret, crep[coclass]);
100 copy_edges_fast(&ret, erep[esep]);
101 set_eo_fast(&ret, eo); 94 set_eo_fast(&ret, eo);
102 95
103 return ret; 96 return ret;
diff --git a/test/078_invcoord_esep/00_solved.in b/test/078_invcoord_esep/00_solved.in
new file mode 100644
index 0000000..dff224d
--- /dev/null
+++ b/test/078_invcoord_esep/00_solved.in
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/078_invcoord_esep/00_solved.out b/test/078_invcoord_esep/00_solved.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/078_invcoord_esep/00_solved.out
@@ -0,0 +1 @@
0
diff --git a/test/078_invcoord_esep/01_U.in b/test/078_invcoord_esep/01_U.in
new file mode 100644
index 0000000..b5b36ad
--- /dev/null
+++ b/test/078_invcoord_esep/01_U.in
@@ -0,0 +1 @@
UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0
diff --git a/test/078_invcoord_esep/01_U.out b/test/078_invcoord_esep/01_U.out
new file mode 100644
index 0000000..c3f407c
--- /dev/null
+++ b/test/078_invcoord_esep/01_U.out
@@ -0,0 +1 @@
55
diff --git a/test/078_invcoord_esep/02_U2.in b/test/078_invcoord_esep/02_U2.in
new file mode 100644
index 0000000..316ad57
--- /dev/null
+++ b/test/078_invcoord_esep/02_U2.in
@@ -0,0 +1 @@
UB0 UF0 DB0 DF0 UL0 UR0 DL0 DR0 FR0 FL0 BL0 BR0 UBL0 UFR0 DFL0 DBR0 UBR0 UFL0 DFR0 DBL0
diff --git a/test/078_invcoord_esep/02_U2.out b/test/078_invcoord_esep/02_U2.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/078_invcoord_esep/02_U2.out
@@ -0,0 +1 @@
0
diff --git a/test/078_invcoord_esep/20_scrambled.in b/test/078_invcoord_esep/20_scrambled.in
new file mode 100644
index 0000000..274d30b
--- /dev/null
+++ b/test/078_invcoord_esep/20_scrambled.in
@@ -0,0 +1,3 @@
1UL0 BL0 BR1 DL0 FR0 DF0 DB1 DR1 UB0 FL0 UF0 UR1 DFL0 UFR1 DBR1 UBR2 DBL2 DFR0 UFL1 UBL2
2
3// Scramble: U R D' L D' F L2 D L F B D2 B' L2 F U2 L2 D2 R2 L2 B'
diff --git a/test/078_invcoord_esep/20_scrambled.out b/test/078_invcoord_esep/20_scrambled.out
new file mode 100644
index 0000000..b204ff8
--- /dev/null
+++ b/test/078_invcoord_esep/20_scrambled.out
@@ -0,0 +1 @@
22248
diff --git a/test/078_invcoord_esep/21_swapaxis_FB.in b/test/078_invcoord_esep/21_swapaxis_FB.in
new file mode 100644
index 0000000..d06e331
--- /dev/null
+++ b/test/078_invcoord_esep/21_swapaxis_FB.in
@@ -0,0 +1 @@
FR0 BR0 BL0 FL0 UR0 UL0 DL0 DR0 DF0 UF0 UB0 DB0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/078_invcoord_esep/21_swapaxis_FB.out b/test/078_invcoord_esep/21_swapaxis_FB.out
new file mode 100644
index 0000000..cb33fb1
--- /dev/null
+++ b/test/078_invcoord_esep/21_swapaxis_FB.out
@@ -0,0 +1 @@
34649
diff --git a/test/078_invcoord_esep/22_swapaxis_RL.in b/test/078_invcoord_esep/22_swapaxis_RL.in
new file mode 100644
index 0000000..cb1ea4e
--- /dev/null
+++ b/test/078_invcoord_esep/22_swapaxis_RL.in
@@ -0,0 +1 @@
UF0 UB0 DB0 DF0 FR0 FL0 BL0 BR0 DR0 DL0 UL0 UR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/078_invcoord_esep/22_swapaxis_RL.out b/test/078_invcoord_esep/22_swapaxis_RL.out
new file mode 100644
index 0000000..ddeb3cf
--- /dev/null
+++ b/test/078_invcoord_esep/22_swapaxis_RL.out
@@ -0,0 +1 @@
4830
diff --git a/test/078_invcoord_esep/23_swapaxis_UD.in b/test/078_invcoord_esep/23_swapaxis_UD.in
new file mode 100644
index 0000000..9c57408
--- /dev/null
+++ b/test/078_invcoord_esep/23_swapaxis_UD.in
@@ -0,0 +1 @@
UR0 UL0 DL0 DR0 UB0 UF0 DF0 DB0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/078_invcoord_esep/23_swapaxis_UD.out b/test/078_invcoord_esep/23_swapaxis_UD.out
new file mode 100644
index 0000000..b5489e5
--- /dev/null
+++ b/test/078_invcoord_esep/23_swapaxis_UD.out
@@ -0,0 +1 @@
69
diff --git a/test/078_invcoord_esep/invcoord_esep_tests.c b/test/078_invcoord_esep/invcoord_esep_tests.c
new file mode 100644
index 0000000..167f452
--- /dev/null
+++ b/test/078_invcoord_esep/invcoord_esep_tests.c
@@ -0,0 +1,24 @@
1#include "../test.h"
2
3int64_t coord_fast_esep(cube_fast_t);
4cube_fast_t invcoord_fast_esep(int64_t);
5cube_fast_t cubetofast(cube_t);
6
7int main(void) {
8 char str[STRLENMAX];
9 cube_t cube;
10 cube_fast_t fast;
11 int64_t i;
12
13 fgets(str, STRLENMAX, stdin);
14 cube = readcube("H48", str);
15 fast = cubetofast(cube);
16
17 i = coord_fast_esep(fast);
18 fast = invcoord_fast_esep(i);
19 i = coord_fast_esep(fast);
20
21 printf("%" PRId64 "\n", i);
22
23 return 0;
24}

Generated with cgit - Back to sebastiano.tronto.net