diff options
Diffstat (limited to 'src/symcoord.c')
| -rw-r--r-- | src/symcoord.c | 344 |
1 files changed, 258 insertions, 86 deletions
diff --git a/src/symcoord.c b/src/symcoord.c index 38e13c6..83fba0a 100644 --- a/src/symcoord.c +++ b/src/symcoord.c | |||
| @@ -4,27 +4,43 @@ | |||
| 4 | #define CLASSES_CP_16 2768 | 4 | #define CLASSES_CP_16 2768 |
| 5 | #define CLASSES_EOFBEPOS_16 64430 | 5 | #define CLASSES_EOFBEPOS_16 64430 |
| 6 | 6 | ||
| 7 | static Cube antindex_cp_sym16(uint64_t ind); | ||
| 8 | static Cube antindex_eofbepos_sym16(uint64_t ind); | ||
| 9 | static Cube antindex_drud_sym16(uint64_t ind); | ||
| 10 | static Cube antindex_drudfin_noE_sym16(uint64_t ind); | ||
| 11 | static Cube antindex_nxopt31(uint64_t ind); | ||
| 12 | |||
| 13 | static uint64_t index_cp_sym16(Cube cube); | 7 | static uint64_t index_cp_sym16(Cube cube); |
| 14 | static uint64_t index_eofbepos_sym16(Cube cube); | 8 | static uint64_t index_eofbepos_sym16(Cube cube); |
| 15 | static uint64_t index_drud_sym16(Cube cube); | 9 | static uint64_t index_drud_sym16(Cube cube); |
| 16 | static uint64_t index_drudfin_noE_sym16(Cube cube); | 10 | static uint64_t index_drudfin_noE_sym16(Cube cube); |
| 17 | static uint64_t index_nxopt31(Cube cube); | 11 | static uint64_t index_nxopt31(Cube cube); |
| 18 | 12 | ||
| 19 | static int transfinder_drud_sym16(uint64_t ind, Trans *ret); | 13 | static uint64_t move_cp_sym16(Move m, uint64_t ind); |
| 20 | static int transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret); | 14 | static uint64_t move_eofbepos_sym16(Move m, uint64_t ind); |
| 21 | static int transfinder_nxopt31(uint64_t ind, Trans *ret); | 15 | static uint64_t move_drud_sym16(Move m, uint64_t ind); |
| 16 | static uint64_t move_drudfin_noE_sym16(Move m, uint64_t ind); | ||
| 17 | static uint64_t move_nxopt31(Move m, uint64_t ind); | ||
| 18 | |||
| 19 | static uint64_t transform_cp(Trans t, uint64_t ind); | ||
| 20 | static uint64_t transform_eofbepos(Trans t, uint64_t ind); | ||
| 21 | static uint64_t transform_drud_sym16(Trans t, uint64_t ind); | ||
| 22 | static uint64_t transform_drudfin_noE_sym16(Trans t, uint64_t ind); | ||
| 23 | static uint64_t transform_nxopt31(Trans t, uint64_t ind); | ||
| 22 | 24 | ||
| 23 | static void gensym(SymData *sd); | 25 | static void gensym(SymData *sd); |
| 26 | static void init_symc_moves(); | ||
| 27 | static void init_symc_trans(); | ||
| 24 | static bool read_symdata_file(SymData *sd); | 28 | static bool read_symdata_file(SymData *sd); |
| 25 | static int selfsims(SymData *sd, uint64_t ind, Trans *ret); | ||
| 26 | static bool write_symdata_file(SymData *sd); | 29 | static bool write_symdata_file(SymData *sd); |
| 27 | 30 | ||
| 31 | /* Some tables ***************************************************************/ | ||
| 32 | |||
| 33 | static uint64_t move_cp_16[NMOVES][CLASSES_CP_16]; | ||
| 34 | static uint64_t move_eofbepos_16[NMOVES][CLASSES_EOFBEPOS_16]; | ||
| 35 | |||
| 36 | static int trans_eofbepos[NTRANS][POW2TO11*BINOM12ON4]; | ||
| 37 | static int trans_epud[NTRANS][FACTORIAL8]; | ||
| 38 | static int trans_cpud_separate[NTRANS][BINOM8ON4]; | ||
| 39 | |||
| 40 | static Trans ttrep_move_cp_16[NMOVES][CLASSES_CP_16]; | ||
| 41 | static Trans ttrep_move_eofbepos_16[NMOVES][CLASSES_EOFBEPOS_16]; | ||
| 42 | |||
| 43 | |||
| 28 | /* Transformation groups and symmetry data ***********************************/ | 44 | /* Transformation groups and symmetry data ***********************************/ |
| 29 | 45 | ||
| 30 | static Trans | 46 | static Trans |
| @@ -37,20 +53,22 @@ trans_group_udfix[16] = { | |||
| 37 | 53 | ||
| 38 | static SymData | 54 | static SymData |
| 39 | sd_cp_16 = { | 55 | sd_cp_16 = { |
| 40 | .filename = "sd_cp_16", | 56 | .filename = "sd_cp_16_new", |
| 41 | .coord = &coord_cp, | 57 | .coord = &coord_cp, |
| 42 | .sym_coord = &coord_cp_sym16, | 58 | .sym_coord = &coord_cp_sym16, |
| 43 | .ntrans = 16, | 59 | .ntrans = 16, |
| 44 | .trans = trans_group_udfix | 60 | .trans = trans_group_udfix, |
| 61 | .transform = transform_cp, | ||
| 45 | }; | 62 | }; |
| 46 | 63 | ||
| 47 | static SymData | 64 | static SymData |
| 48 | sd_eofbepos_16 = { | 65 | sd_eofbepos_16 = { |
| 49 | .filename = "sd_eofbepos_16", | 66 | .filename = "sd_eofbepos_16_new", |
| 50 | .coord = &coord_eofbepos, | 67 | .coord = &coord_eofbepos, |
| 51 | .sym_coord = &coord_eofbepos_sym16, | 68 | .sym_coord = &coord_eofbepos_sym16, |
| 52 | .ntrans = 16, | 69 | .ntrans = 16, |
| 53 | .trans = trans_group_udfix | 70 | .trans = trans_group_udfix, |
| 71 | .transform = transform_eofbepos, | ||
| 54 | }; | 72 | }; |
| 55 | 73 | ||
| 56 | SymData * all_sd[] = { | 74 | SymData * all_sd[] = { |
| @@ -65,90 +83,44 @@ SymData * all_sd[] = { | |||
| 65 | Coordinate | 83 | Coordinate |
| 66 | coord_eofbepos_sym16 = { | 84 | coord_eofbepos_sym16 = { |
| 67 | .index = index_eofbepos_sym16, | 85 | .index = index_eofbepos_sym16, |
| 68 | .cube = antindex_eofbepos_sym16, | 86 | .move = move_eofbepos_sym16, |
| 69 | }; | 87 | }; |
| 70 | 88 | ||
| 71 | Coordinate | 89 | Coordinate |
| 72 | coord_cp_sym16 = { | 90 | coord_cp_sym16 = { |
| 73 | .index = index_cp_sym16, | 91 | .index = index_cp_sym16, |
| 74 | .cube = antindex_cp_sym16, | 92 | .move = move_cp_sym16, |
| 75 | }; | 93 | }; |
| 76 | 94 | ||
| 77 | Coordinate | 95 | Coordinate |
| 78 | coord_drud_sym16 = { | 96 | coord_drud_sym16 = { |
| 79 | .index = index_drud_sym16, | 97 | .index = index_drud_sym16, |
| 80 | .cube = antindex_drud_sym16, | 98 | .move = move_drud_sym16, |
| 81 | .max = POW3TO7 * CLASSES_EOFBEPOS_16, | 99 | .max = POW3TO7 * CLASSES_EOFBEPOS_16, |
| 82 | .transfind = transfinder_drud_sym16, | 100 | .transform = transform_drud_sym16, |
| 101 | .sd = &sd_cp_16, | ||
| 83 | }; | 102 | }; |
| 84 | 103 | ||
| 85 | Coordinate | 104 | Coordinate |
| 86 | coord_drudfin_noE_sym16 = { | 105 | coord_drudfin_noE_sym16 = { |
| 87 | .index = index_drudfin_noE_sym16, | 106 | .index = index_drudfin_noE_sym16, |
| 88 | .cube = antindex_drudfin_noE_sym16, | 107 | .move = move_drudfin_noE_sym16, |
| 89 | .max = FACTORIAL8 * CLASSES_CP_16, | 108 | .max = FACTORIAL8 * CLASSES_CP_16, |
| 90 | .transfind = transfinder_drudfin_noE_sym16, | 109 | .transform = transform_drudfin_noE_sym16, |
| 110 | .sd = &sd_eofbepos_16, | ||
| 91 | }; | 111 | }; |
| 92 | 112 | ||
| 93 | Coordinate | 113 | Coordinate |
| 94 | coord_nxopt31 = { | 114 | coord_nxopt31 = { |
| 95 | .index = index_nxopt31, | 115 | .index = index_nxopt31, |
| 96 | .cube = antindex_nxopt31, | 116 | .move = move_nxopt31, |
| 97 | .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16, | 117 | .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16, |
| 98 | .transfind = transfinder_nxopt31, | 118 | .transform = transform_nxopt31, |
| 119 | .sd = &sd_eofbepos_16, | ||
| 99 | }; | 120 | }; |
| 100 | 121 | ||
| 101 | /* Functions *****************************************************************/ | 122 | /* Functions *****************************************************************/ |
| 102 | 123 | ||
| 103 | static Cube | ||
| 104 | antindex_cp_sym16(uint64_t ind) | ||
| 105 | { | ||
| 106 | return sd_cp_16.rep[ind]; | ||
| 107 | } | ||
| 108 | |||
| 109 | static Cube | ||
| 110 | antindex_eofbepos_sym16(uint64_t ind) | ||
| 111 | { | ||
| 112 | return sd_eofbepos_16.rep[ind]; | ||
| 113 | } | ||
| 114 | |||
| 115 | static Cube | ||
| 116 | antindex_drud_sym16(uint64_t ind) | ||
| 117 | { | ||
| 118 | Cube c; | ||
| 119 | |||
| 120 | c = antindex_eofbepos_sym16(ind/POW3TO7); | ||
| 121 | c.coud = ind % POW3TO7; | ||
| 122 | c.cofb = c.coud; | ||
| 123 | c.corl = c.coud; | ||
| 124 | |||
| 125 | return c; | ||
| 126 | } | ||
| 127 | |||
| 128 | static Cube | ||
| 129 | antindex_drudfin_noE_sym16(uint64_t ind) | ||
| 130 | { | ||
| 131 | Cube c1, c2; | ||
| 132 | |||
| 133 | c1 = coord_epud.cube(ind % FACTORIAL8); | ||
| 134 | c2 = antindex_cp_sym16(ind/FACTORIAL8); | ||
| 135 | c1.cp = c2.cp; | ||
| 136 | |||
| 137 | return c1; | ||
| 138 | } | ||
| 139 | |||
| 140 | static Cube | ||
| 141 | antindex_nxopt31(uint64_t ind) | ||
| 142 | { | ||
| 143 | Cube c; | ||
| 144 | |||
| 145 | c = antindex_eofbepos_sym16(ind/(BINOM8ON4*POW3TO7)); | ||
| 146 | c.cp = coord_cpud_separate.cube(ind % BINOM8ON4).cp; | ||
| 147 | c.coud = (ind / BINOM8ON4) % POW3TO7; | ||
| 148 | |||
| 149 | return c; | ||
| 150 | } | ||
| 151 | |||
| 152 | static uint64_t | 124 | static uint64_t |
| 153 | index_cp_sym16(Cube cube) | 125 | index_cp_sym16(Cube cube) |
| 154 | { | 126 | { |
| @@ -198,6 +170,116 @@ index_nxopt31(Cube cube) | |||
| 198 | return a * BINOM8ON4 + coord_cpud_separate.index((Cube){.cp = cp}); | 170 | return a * BINOM8ON4 + coord_cpud_separate.index((Cube){.cp = cp}); |
| 199 | } | 171 | } |
| 200 | 172 | ||
| 173 | static uint64_t | ||
| 174 | move_cp_sym16(Move m, uint64_t ind) | ||
| 175 | { | ||
| 176 | return move_cp_16[m][ind]; | ||
| 177 | } | ||
| 178 | |||
| 179 | static uint64_t | ||
| 180 | move_eofbepos_sym16(Move m, uint64_t ind) | ||
| 181 | { | ||
| 182 | return move_eofbepos_16[m][ind]; | ||
| 183 | } | ||
| 184 | |||
| 185 | static uint64_t | ||
| 186 | move_drud_sym16(Move m, uint64_t ind) | ||
| 187 | { | ||
| 188 | uint64_t coud, eofbepos; | ||
| 189 | Trans ttr; | ||
| 190 | |||
| 191 | eofbepos = move_eofbepos_16[m][ind / POW3TO7]; | ||
| 192 | ttr = ttrep_move_eofbepos_16[m][ind / POW3TO7]; | ||
| 193 | coud = coud_mtable[m][ind % POW3TO7]; | ||
| 194 | coud = co_ttable[ttr][coud]; /* Source is always coud */ | ||
| 195 | |||
| 196 | return eofbepos * POW3TO7 + coud; | ||
| 197 | } | ||
| 198 | |||
| 199 | static uint64_t | ||
| 200 | move_drudfin_noE_sym16(Move m, uint64_t ind) | ||
| 201 | { | ||
| 202 | uint64_t cp, epud; | ||
| 203 | Trans ttr; | ||
| 204 | |||
| 205 | cp = move_cp_16[m][ind / FACTORIAL8]; | ||
| 206 | ttr = ttrep_move_cp_16[m][ind / FACTORIAL8]; | ||
| 207 | epud = coord_epud.move(m, ind % FACTORIAL8); | ||
| 208 | epud = trans_epud[ttr][epud]; | ||
| 209 | |||
| 210 | return cp * FACTORIAL8 + epud; | ||
| 211 | } | ||
| 212 | |||
| 213 | static uint64_t | ||
| 214 | move_nxopt31(Move m, uint64_t ind) | ||
| 215 | { | ||
| 216 | uint64_t eofbepos, cpsep, coud; | ||
| 217 | Trans ttr; | ||
| 218 | |||
| 219 | eofbepos = ind / (POW3TO7 * BINOM8ON4); | ||
| 220 | coud = (ind / BINOM8ON4) % POW3TO7; | ||
| 221 | cpsep = ind % BINOM8ON4; | ||
| 222 | |||
| 223 | eofbepos = move_eofbepos_16[m][eofbepos]; | ||
| 224 | ttr = ttrep_move_eofbepos_16[m][eofbepos]; | ||
| 225 | coud = coud_mtable[m][coud]; | ||
| 226 | coud = co_ttable[ttr][coud]; /* Source is always coud */ | ||
| 227 | cpsep = coord_cpud_separate.move(m, cpsep); | ||
| 228 | cpsep = trans_cpud_separate[ttr][cpsep]; | ||
| 229 | |||
| 230 | return (eofbepos * POW3TO7 + coud) * BINOM8ON4 + cpsep; | ||
| 231 | } | ||
| 232 | |||
| 233 | static uint64_t | ||
| 234 | transform_cp(Trans t, uint64_t ind) | ||
| 235 | { | ||
| 236 | return cp_ttable[t][ind]; | ||
| 237 | } | ||
| 238 | |||
| 239 | static uint64_t | ||
| 240 | transform_eofbepos(Trans t, uint64_t ind) | ||
| 241 | { | ||
| 242 | return trans_eofbepos[t][ind]; | ||
| 243 | } | ||
| 244 | |||
| 245 | static uint64_t | ||
| 246 | transform_drud_sym16(Trans t, uint64_t ind) | ||
| 247 | { | ||
| 248 | uint64_t coud, eofbepos; | ||
| 249 | |||
| 250 | eofbepos = ind / POW3TO7; /* Assum trans fixes eofbepos */ | ||
| 251 | coud = co_ttable[t][ind % POW3TO7]; /* Source is always coud */ | ||
| 252 | |||
| 253 | return eofbepos * POW3TO7 + coud; | ||
| 254 | } | ||
| 255 | |||
| 256 | static uint64_t | ||
| 257 | transform_drudfin_noE_sym16(Trans t, uint64_t ind) | ||
| 258 | { | ||
| 259 | uint64_t cp, epud; | ||
| 260 | |||
| 261 | cp = ind / FACTORIAL8; /* Assume trans fixes eofbepos */ | ||
| 262 | epud = trans_epud[t][ind % FACTORIAL8]; | ||
| 263 | |||
| 264 | return cp * FACTORIAL8 + epud; | ||
| 265 | } | ||
| 266 | |||
| 267 | static uint64_t | ||
| 268 | transform_nxopt31(Trans t, uint64_t ind) | ||
| 269 | { | ||
| 270 | uint64_t eofbepos, cpsep, coud; | ||
| 271 | |||
| 272 | eofbepos = ind / (POW3TO7 * BINOM8ON4); | ||
| 273 | coud = (ind / BINOM8ON4) % POW3TO7; | ||
| 274 | cpsep = ind % BINOM8ON4; | ||
| 275 | |||
| 276 | coud = co_ttable[t][coud]; /* Source is always coud */ | ||
| 277 | cpsep = trans_cpud_separate[t][cpsep]; | ||
| 278 | |||
| 279 | return (eofbepos * POW3TO7 + coud) * BINOM8ON4 + cpsep; | ||
| 280 | } | ||
| 281 | |||
| 282 | /* | ||
| 201 | static int | 283 | static int |
| 202 | transfinder_drud_sym16(uint64_t ind, Trans *ret) | 284 | transfinder_drud_sym16(uint64_t ind, Trans *ret) |
| 203 | { | 285 | { |
| @@ -264,6 +346,8 @@ transfinder_nxopt31(uint64_t ind, Trans *ret) | |||
| 264 | return naux[trueind]; | 346 | return naux[trueind]; |
| 265 | } | 347 | } |
| 266 | 348 | ||
| 349 | */ | ||
| 350 | |||
| 267 | /* Other functions ***********************************************************/ | 351 | /* Other functions ***********************************************************/ |
| 268 | 352 | ||
| 269 | void | 353 | void |
| @@ -271,7 +355,7 @@ free_sd(SymData *sd) | |||
| 271 | { | 355 | { |
| 272 | if (sd->generated) { | 356 | if (sd->generated) { |
| 273 | free(sd->class); | 357 | free(sd->class); |
| 274 | free(sd->rep); | 358 | free(sd->unsym); |
| 275 | free(sd->transtorep); | 359 | free(sd->transtorep); |
| 276 | } | 360 | } |
| 277 | 361 | ||
| @@ -282,15 +366,16 @@ static void | |||
| 282 | gensym(SymData *sd) | 366 | gensym(SymData *sd) |
| 283 | { | 367 | { |
| 284 | uint64_t i, in, nreps = 0; | 368 | uint64_t i, in, nreps = 0; |
| 369 | Trans t; | ||
| 285 | int j; | 370 | int j; |
| 286 | Cube c, d; | ||
| 287 | 371 | ||
| 288 | if (sd->generated) | 372 | if (sd->generated) |
| 289 | return; | 373 | return; |
| 290 | 374 | ||
| 291 | sd->class = malloc(sd->coord->max * sizeof(uint64_t)); | 375 | sd->class = malloc(sd->coord->max * sizeof(uint64_t)); |
| 292 | sd->rep = malloc(sd->coord->max * sizeof(Cube)); | 376 | sd->unsym = malloc(sd->coord->max * sizeof(uint64_t)); |
| 293 | sd->transtorep = malloc(sd->coord->max * sizeof(Trans)); | 377 | sd->transtorep = malloc(sd->coord->max * sizeof(Trans)); |
| 378 | sd->selfsim = malloc(sd->coord->max * sizeof(uint64_t)); | ||
| 294 | 379 | ||
| 295 | if (read_symdata_file(sd)) { | 380 | if (read_symdata_file(sd)) { |
| 296 | sd->generated = true; | 381 | sd->generated = true; |
| @@ -304,16 +389,17 @@ gensym(SymData *sd) | |||
| 304 | 389 | ||
| 305 | for (i = 0; i < sd->coord->max; i++) { | 390 | for (i = 0; i < sd->coord->max; i++) { |
| 306 | if (sd->class[i] == sd->coord->max + 1) { | 391 | if (sd->class[i] == sd->coord->max + 1) { |
| 307 | c = sd->coord->cube(i); | 392 | sd->unsym[nreps] = i; |
| 308 | sd->rep[nreps] = c; | 393 | sd->selfsim[nreps] = 0; |
| 309 | for (j = 0; j < sd->ntrans; j++) { | 394 | for (j = 0; j < sd->ntrans; j++) { |
| 310 | d = apply_trans(sd->trans[j], c); | 395 | t = sd->trans[j]; |
| 311 | in = sd->coord->index(d); | 396 | in = sd->transform(t, i); |
| 312 | 397 | sd->class[in] = nreps; | |
| 313 | if (sd->class[in] == sd->coord->max + 1) { | 398 | if (in == i) { |
| 314 | sd->class[in] = nreps; | 399 | sd->selfsim[nreps] |= (1 << t); |
| 315 | sd->transtorep[in] = | 400 | sd->transtorep[in] = uf; |
| 316 | inverse_trans(sd->trans[j]); | 401 | } else { |
| 402 | sd->transtorep[in] = inverse_trans(t); | ||
| 317 | } | 403 | } |
| 318 | } | 404 | } |
| 319 | nreps++; | 405 | nreps++; |
| @@ -321,7 +407,8 @@ gensym(SymData *sd) | |||
| 321 | } | 407 | } |
| 322 | 408 | ||
| 323 | sd->sym_coord->max = nreps; | 409 | sd->sym_coord->max = nreps; |
| 324 | sd->rep = realloc(sd->rep, nreps * sizeof(Cube)); | 410 | sd->unsym = realloc(sd->unsym, nreps * sizeof(uint64_t)); |
| 411 | sd->selfsim = realloc(sd->selfsim, nreps * sizeof(uint64_t)); | ||
| 325 | sd->generated = true; | 412 | sd->generated = true; |
| 326 | 413 | ||
| 327 | fprintf(stderr, "Found %" PRIu64 " classes\n", nreps); | 414 | fprintf(stderr, "Found %" PRIu64 " classes\n", nreps); |
| @@ -350,7 +437,8 @@ read_symdata_file(SymData *sd) | |||
| 350 | return false; | 437 | return false; |
| 351 | 438 | ||
| 352 | r = r && fread(&sd->sym_coord->max, sizeof(uint64_t), 1, f) == 1; | 439 | r = r && fread(&sd->sym_coord->max, sizeof(uint64_t), 1, f) == 1; |
| 353 | r = r && fread(sd->rep, sizeof(Cube), *sn, f) == *sn; | 440 | r = r && fread(sd->unsym, sizeof(uint64_t), *sn, f) == *sn; |
| 441 | r = r && fread(sd->selfsim, sizeof(uint64_t), *sn, f) == *sn; | ||
| 354 | r = r && fread(sd->class, sizeof(uint64_t), n, f) == n; | 442 | r = r && fread(sd->class, sizeof(uint64_t), n, f) == n; |
| 355 | r = r && fread(sd->transtorep, sizeof(Trans), n, f) == n; | 443 | r = r && fread(sd->transtorep, sizeof(Trans), n, f) == n; |
| 356 | 444 | ||
| @@ -358,6 +446,7 @@ read_symdata_file(SymData *sd) | |||
| 358 | return r; | 446 | return r; |
| 359 | } | 447 | } |
| 360 | 448 | ||
| 449 | /* | ||
| 361 | static int | 450 | static int |
| 362 | selfsims(SymData *sd, uint64_t ind, Trans *ret) | 451 | selfsims(SymData *sd, uint64_t ind, Trans *ret) |
| 363 | { | 452 | { |
| @@ -376,6 +465,7 @@ selfsims(SymData *sd, uint64_t ind, Trans *ret) | |||
| 376 | 465 | ||
| 377 | return n; | 466 | return n; |
| 378 | } | 467 | } |
| 468 | */ | ||
| 379 | 469 | ||
| 380 | static bool | 470 | static bool |
| 381 | write_symdata_file(SymData *sd) | 471 | write_symdata_file(SymData *sd) |
| @@ -395,7 +485,8 @@ write_symdata_file(SymData *sd) | |||
| 395 | return false; | 485 | return false; |
| 396 | 486 | ||
| 397 | r = r && fwrite(&sd->sym_coord->max, sizeof(uint64_t), 1, f) == 1; | 487 | r = r && fwrite(&sd->sym_coord->max, sizeof(uint64_t), 1, f) == 1; |
| 398 | r = r && fwrite(sd->rep, sizeof(Cube), *sn, f) == *sn; | 488 | r = r && fwrite(sd->unsym, sizeof(uint64_t), *sn, f) == *sn; |
| 489 | r = r && fwrite(sd->selfsim, sizeof(uint64_t), *sn, f) == *sn; | ||
| 399 | r = r && fwrite(sd->class, sizeof(uint64_t), n, f) == n; | 490 | r = r && fwrite(sd->class, sizeof(uint64_t), n, f) == n; |
| 400 | r = r && fwrite(sd->transtorep, sizeof(Trans), n, f) == n; | 491 | r = r && fwrite(sd->transtorep, sizeof(Trans), n, f) == n; |
| 401 | 492 | ||
| @@ -403,6 +494,83 @@ write_symdata_file(SymData *sd) | |||
| 403 | return r; | 494 | return r; |
| 404 | } | 495 | } |
| 405 | 496 | ||
| 497 | static void | ||
| 498 | init_symc_moves() | ||
| 499 | { | ||
| 500 | uint64_t i, ii; | ||
| 501 | Move j; | ||
| 502 | |||
| 503 | for (i = 0; i < CLASSES_CP_16; i++) { | ||
| 504 | ii = sd_cp_16.unsym[i]; | ||
| 505 | for (j = 0; j < NMOVES; j++) { | ||
| 506 | move_cp_16[j][i] = sd_cp_16.coord->move(j, ii); | ||
| 507 | ttrep_move_cp_16[j][i] = sd_cp_16.transtorep[ii]; | ||
| 508 | } | ||
| 509 | } | ||
| 510 | |||
| 511 | for (i = 0; i < CLASSES_EOFBEPOS_16; i++) { | ||
| 512 | ii = sd_eofbepos_16.unsym[i]; | ||
| 513 | for (j = 0; j < NMOVES; j++) { | ||
| 514 | move_eofbepos_16[j][i] = | ||
| 515 | sd_eofbepos_16.coord->move(j, ii); | ||
| 516 | ttrep_move_eofbepos_16[j][i] = | ||
| 517 | sd_eofbepos_16.transtorep[ii]; | ||
| 518 | } | ||
| 519 | } | ||
| 520 | } | ||
| 521 | |||
| 522 | void | ||
| 523 | init_symc_trans() | ||
| 524 | { | ||
| 525 | uint64_t i; | ||
| 526 | int j, cp; | ||
| 527 | int epe[4] = {FR, FL, BL, BR}; | ||
| 528 | int a[12] = { [8] = 8, [9] = 9, [10] = 10, [11] = 11 }; | ||
| 529 | Cube c; | ||
| 530 | CubeArray *arr, *aux; | ||
| 531 | Trans t; | ||
| 532 | |||
| 533 | for (i = 0; i < POW2TO11*BINOM12ON4; i++) { | ||
| 534 | for (j = 0; j < 16; j++) { | ||
| 535 | t = trans_group_udfix[j]; | ||
| 536 | |||
| 537 | arr = new_cubearray((Cube){0}, pf_edges); | ||
| 538 | int_to_sum_zero_array(i/BINOM12ON4, 2, 12, arr->eofb); | ||
| 539 | epos_to_compatible_ep((i%BINOM12ON4)*24, arr->ep, epe); | ||
| 540 | fix_eorleoud(arr); | ||
| 541 | c = arrays_to_cube(arr, pf_edges); | ||
| 542 | free_cubearray(arr, pf_edges); | ||
| 543 | |||
| 544 | c = apply_trans(t, c); | ||
| 545 | trans_eofbepos[t][i] = | ||
| 546 | c.eofb * BINOM12ON4 + (c.epose / 24); | ||
| 547 | } | ||
| 548 | } | ||
| 549 | |||
| 550 | aux = malloc(sizeof(CubeArray)); | ||
| 551 | aux->ep = a; | ||
| 552 | for (i = 0; i < FACTORIAL8; i++) { | ||
| 553 | index_to_perm(i, 8, a); | ||
| 554 | c = arrays_to_cube(aux, pf_ep); | ||
| 555 | for (j = 0; j < 16; j++) { | ||
| 556 | t = trans_group_udfix[j]; | ||
| 557 | arr = new_cubearray(apply_trans(t, c), pf_ep); | ||
| 558 | trans_epud[t][i] = perm_to_index(arr->ep, 8); | ||
| 559 | free_cubearray(arr, pf_ep); | ||
| 560 | } | ||
| 561 | } | ||
| 562 | free(aux); | ||
| 563 | |||
| 564 | for (i = 0; i < BINOM8ON4; i++) { | ||
| 565 | cp = cpud_separate_ant[i]; | ||
| 566 | for (j = 0; j < 16; j++) { | ||
| 567 | t = trans_group_udfix[j]; | ||
| 568 | trans_cpud_separate[j][i] = | ||
| 569 | cpud_separate_ind[cp_ttable[t][cp]]; | ||
| 570 | } | ||
| 571 | } | ||
| 572 | } | ||
| 573 | |||
| 406 | void | 574 | void |
| 407 | init_symcoord() | 575 | init_symcoord() |
| 408 | { | 576 | { |
| @@ -415,7 +583,11 @@ init_symcoord() | |||
| 415 | 583 | ||
| 416 | init_coord(); | 584 | init_coord(); |
| 417 | 585 | ||
| 586 | init_symc_trans(); | ||
| 587 | |||
| 418 | for (i = 0; all_sd[i] != NULL; i++) | 588 | for (i = 0; all_sd[i] != NULL; i++) |
| 419 | gensym(all_sd[i]); | 589 | gensym(all_sd[i]); |
| 590 | |||
| 591 | init_symc_moves(); | ||
| 420 | } | 592 | } |
| 421 | 593 | ||
