aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2022-06-01 09:34:35 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2022-06-01 09:34:35 +0200
commit62c9e8012e9a0844d9597b90723a928b71ad103b (patch)
treea71621010f556333b10b85cf0ecf3398fd3a4734
parentf021ee7fa4975eab02c158451093a28e83a725d9 (diff)
downloadnissy-62c9e8012e9a0844d9597b90723a928b71ad103b.tar.gz
nissy-62c9e8012e9a0844d9597b90723a928b71ad103b.zip
Fixed some bugs - still more testing needed
-rw-r--r--TODO.md1
-rwxr-xr-xnissybin327792 -> 327920 bytes
-rw-r--r--src/coord.c2
-rw-r--r--src/cubetypes.h1
-rw-r--r--src/pruning.c16
-rw-r--r--src/symcoord.c118
6 files changed, 56 insertions, 82 deletions
diff --git a/TODO.md b/TODO.md
index 4fe3a5d..612dd48 100644
--- a/TODO.md
+++ b/TODO.md
@@ -5,6 +5,7 @@ It's more of a personal reminder than anything else.
5 5
6## For version 2.1 6## For version 2.1
7### Moving coordinates 7### Moving coordinates
8* memorize some tables from symcoord in files
8* general cleanup 9* general cleanup
9### Changes to Step and Solve 10### Changes to Step and Solve
10* add a list of "helper" coordinates to every step 11* add a list of "helper" coordinates to every step
diff --git a/nissy b/nissy
index ac2e2c0..67d8910 100755
--- a/nissy
+++ b/nissy
Binary files differ
diff --git a/src/coord.c b/src/coord.c
index abfa1b9..3812ae3 100644
--- a/src/coord.c
+++ b/src/coord.c
@@ -280,7 +280,7 @@ move_eofbepos(Move m, uint64_t ind)
280 a = epose_mtable[m][(ind / POW2TO11)*24]; 280 a = epose_mtable[m][(ind / POW2TO11)*24];
281 b = eofb_mtable[m][ind % POW2TO11]; 281 b = eofb_mtable[m][ind % POW2TO11];
282 282
283 return a/24 + b; 283 return (a/24) * POW2TO11 + b;
284} 284}
285 285
286static uint64_t 286static uint64_t
diff --git a/src/cubetypes.h b/src/cubetypes.h
index 3ba667c..109c6c4 100644
--- a/src/cubetypes.h
+++ b/src/cubetypes.h
@@ -172,6 +172,7 @@ coordinate
172 CoordMover move; 172 CoordMover move;
173 CoordTransformer transform; 173 CoordTransformer transform;
174 SymData * sd; 174 SymData * sd;
175 TransFinder tfind; /* TODO: should be easy to remove */
175}; 176};
176 177
177struct 178struct
diff --git a/src/pruning.c b/src/pruning.c
index 36445b7..6cab7e7 100644
--- a/src/pruning.c
+++ b/src/pruning.c
@@ -258,22 +258,20 @@ genptable_compress(PruneData *pd)
258static void 258static void
259genptable_fixnasty(PruneData *pd, int d) 259genptable_fixnasty(PruneData *pd, int d)
260{ 260{
261 uint64_t i, ii, mask; 261 uint64_t i, ii;
262 Trans t; 262 int j, n;
263 Trans t, aux[NTRANS];
263 264
264 if (pd->coord->sd == NULL) 265 if (pd->coord->tfind == NULL)
265 return; 266 return;
266 267
267 for (i = 0; i < pd->coord->max; i++) { 268 for (i = 0; i < pd->coord->max; i++) {
268 if (ptableval_index(pd, i) == d) { 269 if (ptableval_index(pd, i) == d) {
269 mask = pd->coord->sd->selfsim[i]; 270 if ((n = pd->coord->tfind(i, aux)) == 1)
270 if (mask == (1 << uf))
271 continue; 271 continue;
272 272
273 for (t = 0; t < NTRANS; t++) { 273 for (j = 0; j < n; j++) {
274 if (!((1 << t) & mask)) 274 t = aux[j];
275 continue;
276
277 ii = pd->coord->transform(t, i); 275 ii = pd->coord->transform(t, i);
278 if (ptableval_index(pd, ii) > d) { 276 if (ptableval_index(pd, ii) > d) {
279 ptable_update_index(pd, ii, d); 277 ptable_update_index(pd, ii, d);
diff --git a/src/symcoord.c b/src/symcoord.c
index 83fba0a..202a4bf 100644
--- a/src/symcoord.c
+++ b/src/symcoord.c
@@ -16,6 +16,11 @@ static uint64_t move_drud_sym16(Move m, uint64_t ind);
16static uint64_t move_drudfin_noE_sym16(Move m, uint64_t ind); 16static uint64_t move_drudfin_noE_sym16(Move m, uint64_t ind);
17static uint64_t move_nxopt31(Move m, uint64_t ind); 17static uint64_t move_nxopt31(Move m, uint64_t ind);
18 18
19static int tfind_from_mask(uint64_t mask, Trans *ret);
20static int tfind_drud_sym16(uint64_t ind, Trans *ret);
21static int tfind_drudfin_noE_sym16(uint64_t ind, Trans *ret);
22static int tfind_nxopt31(uint64_t ind, Trans *ret);
23
19static uint64_t transform_cp(Trans t, uint64_t ind); 24static uint64_t transform_cp(Trans t, uint64_t ind);
20static uint64_t transform_eofbepos(Trans t, uint64_t ind); 25static uint64_t transform_eofbepos(Trans t, uint64_t ind);
21static uint64_t transform_drud_sym16(Trans t, uint64_t ind); 26static uint64_t transform_drud_sym16(Trans t, uint64_t ind);
@@ -98,7 +103,7 @@ coord_drud_sym16 = {
98 .move = move_drud_sym16, 103 .move = move_drud_sym16,
99 .max = POW3TO7 * CLASSES_EOFBEPOS_16, 104 .max = POW3TO7 * CLASSES_EOFBEPOS_16,
100 .transform = transform_drud_sym16, 105 .transform = transform_drud_sym16,
101 .sd = &sd_cp_16, 106 .tfind = tfind_drud_sym16,
102}; 107};
103 108
104Coordinate 109Coordinate
@@ -107,7 +112,7 @@ coord_drudfin_noE_sym16 = {
107 .move = move_drudfin_noE_sym16, 112 .move = move_drudfin_noE_sym16,
108 .max = FACTORIAL8 * CLASSES_CP_16, 113 .max = FACTORIAL8 * CLASSES_CP_16,
109 .transform = transform_drudfin_noE_sym16, 114 .transform = transform_drudfin_noE_sym16,
110 .sd = &sd_eofbepos_16, 115 .tfind = tfind_drudfin_noE_sym16,
111}; 116};
112 117
113Coordinate 118Coordinate
@@ -116,7 +121,7 @@ coord_nxopt31 = {
116 .move = move_nxopt31, 121 .move = move_nxopt31,
117 .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16, 122 .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16,
118 .transform = transform_nxopt31, 123 .transform = transform_nxopt31,
119 .sd = &sd_eofbepos_16, 124 .tfind = tfind_nxopt31,
120}; 125};
121 126
122/* Functions *****************************************************************/ 127/* Functions *****************************************************************/
@@ -146,6 +151,7 @@ index_drudfin_noE_sym16(Cube cube)
146 t = sd_cp_16.transtorep[coord_cp.index(cube)]; 151 t = sd_cp_16.transtorep[coord_cp.index(cube)];
147 c = apply_trans(t, cube); 152 c = apply_trans(t, cube);
148 153
154 /* TODO: add transform to coord_epud to make this faster */
149 return index_cp_sym16(c) * FACTORIAL8 + coord_epud.index(c); 155 return index_cp_sym16(c) * FACTORIAL8 + coord_epud.index(c);
150} 156}
151 157
@@ -258,7 +264,7 @@ transform_drudfin_noE_sym16(Trans t, uint64_t ind)
258{ 264{
259 uint64_t cp, epud; 265 uint64_t cp, epud;
260 266
261 cp = ind / FACTORIAL8; /* Assume trans fixes eofbepos */ 267 cp = ind / FACTORIAL8; /* Assume trans fixes cp */
262 epud = trans_epud[t][ind % FACTORIAL8]; 268 epud = trans_epud[t][ind % FACTORIAL8];
263 269
264 return cp * FACTORIAL8 + epud; 270 return cp * FACTORIAL8 + epud;
@@ -279,75 +285,43 @@ transform_nxopt31(Trans t, uint64_t ind)
279 return (eofbepos * POW3TO7 + coud) * BINOM8ON4 + cpsep; 285 return (eofbepos * POW3TO7 + coud) * BINOM8ON4 + cpsep;
280} 286}
281 287
282/*
283static int 288static int
284transfinder_drud_sym16(uint64_t ind, Trans *ret) 289tfind_from_mask(uint64_t mask, Trans *ret)
285{ 290{
286 uint64_t i, trueind; 291 Trans t;
287 int j; 292 int i = 0;
288 static bool initialized = false;
289 static int naux[CLASSES_EOFBEPOS_16];
290 static Trans retaux[CLASSES_EOFBEPOS_16][NTRANS];
291
292 if (!initialized) {
293 for (i = 0; i < CLASSES_EOFBEPOS_16; i++)
294 naux[i] = selfsims(&sd_eofbepos_16, i, retaux[i]);
295 293
296 initialized = true; 294 for (t = uf; t < NTRANS; t++)
297 } 295 if (((uint64_t)1 << t) & mask)
296 ret[i++] = t;
298 297
299 trueind = ind/POW3TO7; 298 return i;
300 for (j = 0; j < naux[trueind]; j++)
301 ret[j] = retaux[trueind][j];
302 return naux[trueind];
303} 299}
304 300
305static int 301static int
306transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret) 302tfind_drud_sym16(uint64_t ind, Trans *ret)
307{ 303{
308 uint64_t i, trueind; 304 uint64_t mask = sd_eofbepos_16.selfsim[ind / POW3TO7];
309 int j;
310 static bool initialized = false;
311 static int naux[CLASSES_CP_16];
312 static Trans retaux[CLASSES_CP_16][NTRANS];
313
314 if (!initialized) {
315 for (i = 0; i < CLASSES_CP_16; i++)
316 naux[i] = selfsims(&sd_cp_16, i, retaux[i]);
317 305
318 initialized = true; 306 return tfind_from_mask(mask, ret);
319 }
320
321 trueind = ind/FACTORIAL8;
322 for (j = 0; j < naux[trueind]; j++)
323 ret[j] = retaux[trueind][j];
324 return naux[trueind];
325} 307}
326 308
327static int 309static int
328transfinder_nxopt31(uint64_t ind, Trans *ret) 310tfind_drudfin_noE_sym16(uint64_t ind, Trans *ret)
329{ 311{
330 uint64_t i, trueind; 312 uint64_t mask = sd_cp_16.selfsim[ind / FACTORIAL8];
331 int j;
332 static bool initialized = false;
333 static int naux[CLASSES_EOFBEPOS_16];
334 static Trans retaux[CLASSES_EOFBEPOS_16][NTRANS];
335 313
336 if (!initialized) { 314 return tfind_from_mask(mask, ret);
337 for (i = 0; i < CLASSES_EOFBEPOS_16; i++) 315}
338 naux[i] = selfsims(&sd_eofbepos_16, i, retaux[i]);
339 316
340 initialized = true; 317static int
341 } 318tfind_nxopt31(uint64_t ind, Trans *ret)
319{
320 uint64_t mask = sd_eofbepos_16.selfsim[ind / (POW3TO7 * BINOM8ON4)];
342 321
343 trueind = ind/(BINOM8ON4*POW3TO7); 322 return tfind_from_mask(mask, ret);
344 for (j = 0; j < naux[trueind]; j++)
345 ret[j] = retaux[trueind][j];
346 return naux[trueind];
347} 323}
348 324
349*/
350
351/* Other functions ***********************************************************/ 325/* Other functions ***********************************************************/
352 326
353void 327void
@@ -390,17 +364,17 @@ gensym(SymData *sd)
390 for (i = 0; i < sd->coord->max; i++) { 364 for (i = 0; i < sd->coord->max; i++) {
391 if (sd->class[i] == sd->coord->max + 1) { 365 if (sd->class[i] == sd->coord->max + 1) {
392 sd->unsym[nreps] = i; 366 sd->unsym[nreps] = i;
393 sd->selfsim[nreps] = 0; 367 sd->transtorep[i] = uf;
368 sd->selfsim[nreps] = (uint64_t)0;
394 for (j = 0; j < sd->ntrans; j++) { 369 for (j = 0; j < sd->ntrans; j++) {
395 t = sd->trans[j]; 370 t = sd->trans[j];
396 in = sd->transform(t, i); 371 in = sd->transform(t, i);
397 sd->class[in] = nreps; 372 sd->class[in] = nreps;
398 if (in == i) { 373 if (in == i)
399 sd->selfsim[nreps] |= (1 << t); 374 sd->selfsim[nreps] |=
400 sd->transtorep[in] = uf; 375 ((uint64_t)1 << t);
401 } else { 376 else
402 sd->transtorep[in] = inverse_trans(t); 377 sd->transtorep[in] = inverse_trans(t);
403 }
404 } 378 }
405 nreps++; 379 nreps++;
406 } 380 }
@@ -497,24 +471,25 @@ write_symdata_file(SymData *sd)
497static void 471static void
498init_symc_moves() 472init_symc_moves()
499{ 473{
500 uint64_t i, ii; 474 uint64_t i, ii, coo;
501 Move j; 475 Move j;
502 476
503 for (i = 0; i < CLASSES_CP_16; i++) { 477 for (i = 0; i < CLASSES_CP_16; i++) {
504 ii = sd_cp_16.unsym[i]; 478 ii = sd_cp_16.unsym[i];
505 for (j = 0; j < NMOVES; j++) { 479 for (j = 0; j < NMOVES; j++) {
506 move_cp_16[j][i] = sd_cp_16.coord->move(j, ii); 480 coo = sd_cp_16.coord->move(j, ii);
507 ttrep_move_cp_16[j][i] = sd_cp_16.transtorep[ii]; 481 move_cp_16[j][i] = sd_cp_16.class[coo];
482 ttrep_move_cp_16[j][i] = sd_cp_16.transtorep[coo];
508 } 483 }
509 } 484 }
510 485
511 for (i = 0; i < CLASSES_EOFBEPOS_16; i++) { 486 for (i = 0; i < CLASSES_EOFBEPOS_16; i++) {
512 ii = sd_eofbepos_16.unsym[i]; 487 ii = sd_eofbepos_16.unsym[i];
513 for (j = 0; j < NMOVES; j++) { 488 for (j = 0; j < NMOVES; j++) {
514 move_eofbepos_16[j][i] = 489 coo = sd_eofbepos_16.coord->move(j, ii);
515 sd_eofbepos_16.coord->move(j, ii); 490 move_eofbepos_16[j][i] = sd_eofbepos_16.class[coo];
516 ttrep_move_eofbepos_16[j][i] = 491 ttrep_move_eofbepos_16[j][i] =
517 sd_eofbepos_16.transtorep[ii]; 492 sd_eofbepos_16.transtorep[coo];
518 } 493 }
519 } 494 }
520} 495}
@@ -535,15 +510,14 @@ init_symc_trans()
535 t = trans_group_udfix[j]; 510 t = trans_group_udfix[j];
536 511
537 arr = new_cubearray((Cube){0}, pf_edges); 512 arr = new_cubearray((Cube){0}, pf_edges);
538 int_to_sum_zero_array(i/BINOM12ON4, 2, 12, arr->eofb); 513 int_to_sum_zero_array(i % POW2TO11, 2, 12, arr->eofb);
539 epos_to_compatible_ep((i%BINOM12ON4)*24, arr->ep, epe); 514 epos_to_compatible_ep((i / POW2TO11)*24, arr->ep, epe);
540 fix_eorleoud(arr); 515 fix_eorleoud(arr);
541 c = arrays_to_cube(arr, pf_edges); 516 c = arrays_to_cube(arr, pf_edges);
542 free_cubearray(arr, pf_edges); 517 free_cubearray(arr, pf_edges);
543 518
544 c = apply_trans(t, c); 519 c = apply_trans(t, c);
545 trans_eofbepos[t][i] = 520 trans_eofbepos[t][i] = (c.epose/24)*POW2TO11 + c.eofb;
546 c.eofb * BINOM12ON4 + (c.epose / 24);
547 } 521 }
548 } 522 }
549 523
@@ -565,7 +539,7 @@ init_symc_trans()
565 cp = cpud_separate_ant[i]; 539 cp = cpud_separate_ant[i];
566 for (j = 0; j < 16; j++) { 540 for (j = 0; j < 16; j++) {
567 t = trans_group_udfix[j]; 541 t = trans_group_udfix[j];
568 trans_cpud_separate[j][i] = 542 trans_cpud_separate[t][i] =
569 cpud_separate_ind[cp_ttable[t][cp]]; 543 cpud_separate_ind[cp_ttable[t][cp]];
570 } 544 }
571 } 545 }

Generated with cgit - Back to sebastiano.tronto.net