MCPcopy Create free account
hub / github.com/MeigenChou/DCTimer-Android / edgemv

Method edgemv

app/src/main/java/solver/Petrus.java:20–40  ·  view source on GitHub ↗
(int c, int po, int k, int f)

Source from the content-addressed store, hash-verified

18 private static int[] moves2 = {0, 3, 4};
19
20 private static int edgemv(int c, int po, int k, int f) {
21 int[] n = new int[12], s = new int[3];
22 Utils.idxToPerm(s, po, k, false);
23 int t, q = k;
24 for (t = 0; t < 12; t++)
25 if (c >= Utils.Cnk[11 - t][q]) {
26 c -= Utils.Cnk[11 - t][q--];
27 n[t] = s[q] << 1 | po & 1;
28 po >>= 1;
29 } else n[t] = -1;
30 Cross.edgemv(n, f);
31 c = po = 0; q = k;
32 for (t = 0; t < 12; t++)
33 if (n[t] >= 0) {
34 c += Utils.Cnk[11 - t][q--];
35 s[q] = n[t] >> 1;
36 po |= (n[t] & 1) << (k - 1 - q);
37 }
38 int p = Utils.permToIdx(s, k, false);
39 return Utils.fact[k] * c + p << 3 | po;
40 }
41
42 private static boolean ini = false;
43 public static void init() {

Callers 2

initMethod · 0.95
initp2Method · 0.95

Calls 3

idxToPermMethod · 0.95
edgemvMethod · 0.95
permToIdxMethod · 0.95

Tested by

no test coverage detected