aboutsummaryrefslogtreecommitdiff
path: root/src/symcoord.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/symcoord.c')
-rw-r--r--src/symcoord.c118
1 files changed, 46 insertions, 72 deletions
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