def mul_Zp(tag, d, i, g): eps, pi, rep = g.cocode, g.perm, g.rep d1 = m24.op_ploop_autpl(d, rep) i1 = pi[i] s = d1 >> 12 if eps & 0x800: # if eps is odd: tag = Y s ^= d1 >> 11 return s, tag, d1 & 0x7ff, i1
def mul_Xp(tag, d, i, g): eps, pi, rep = g.cocode, g.perm, g.rep d1 = m24.op_ploop_autpl(d, rep) i1 = pi[i] s = d1 >> 12 if eps & 0x800: # if eps is odd: s ^= m24.scalar_prod(d, m24.vect_to_cocode(1 << i)) s ^= m24.pow_ploop(d, 2) >> 12 return s, tag, d1 & 0x7ff, i1
def rule_yp(group, word): global n_rules n_rules += 1 y, p = word[0], word[1] pl = mat24.op_ploop_autpl(y.pl, p.rep) if p.cocode & 0x800: pl = mat24.pow_ploop(pl, 3) return [p, xy_Atom('y', pl), xy_Atom('x', pl)] else: return [p, xy_Atom('y', pl)]
def test_group_ploop(n_cases): print("") for i, (p, g) in enumerate( zip(ploop_testvectors(n_cases), autpl_testwords(n_cases))): pg = p * g if i < 1: print(p, "*", g, "=", pg) pg_ref = PLoop(mat24.op_ploop_autpl(p.ord, g.rep)) assert pg == pg_ref assert p / 4 == pg / 4 == parity(len(p) / 4)
def mul_Tp(tag, octad, sub, g): d = m24.octad_to_gcode(octad) c = m24.suboctad_to_cocode(sub, d) eps, pi, rep = g.cocode, g.perm, g.rep d1 = m24.op_ploop_autpl(d, rep) c1 = m24.op_cocode_perm(c, pi) s = d1 >> 12 s ^= (eps >> 11) & 1 & m24.suboctad_weight(sub) octad1 = m24.gcode_to_octad(d1) sub1 = m24.cocode_to_suboctad(c1, d1) return s, tag, octad1, sub1
def __mul__(self, other): if isinstance(other, PLoop): return PLoop(mat24.mul_ploop(self.value, other.value)) elif isinstance(other, Integral): if abs(other) == 1: return PLoop(self.value ^ ((other & 2) << 11)) return GCode(self.value & -(other & 1)) elif isinstance(other, AutPL): return PLoop(mat24.op_ploop_autpl(self.value, other.rep)) else: return NotImplemented
def map_octad(oct, delta, pi): """Map octad through a Parker loop automorphsim to octad. Here 'oct' is an octad given in ocatad representation, interpreted as a (positive) element of the Parker loop. The pair (delta, pi), with delte a cocode element and pi the number of a permutation in Mat24, is an automorphism of the Parker loop. The function returns a pair (sign, img_octad) representing an element of the Parker loop with a given sign. img_octad is the number of the correspondig octad in octad representation. The return value is the image of the octad under the Parker loop automorphism (delta, pi). """ gcode = mat24.octad_to_gcode(oct) perm = mat24.m24num_to_perm(pi) m = mat24.perm_to_autpl(delta, perm) image = mat24.op_ploop_autpl(gcode, m) image_oct = mat24.gcode_to_octad(image) sign = (image >> 12) & 1 return sign, image_oct
def rule_xp(group, word): global n_rules n_rules += 1 x, p = word[0], word[1] pl = mat24.op_ploop_autpl(x.pl, p.rep) return [p, xy_Atom('x', pl)]