Exemplo n.º 1
0
def autpl_to_xsp2co1(g, aut):
    res = g.word_type(group=g)
    a = np.zeros(2, dtype=uint32)
    a[0] = 0x10000000 + (aut._cocode & 0xfff)  # tag 'd'
    a[1] = 0x20000000 + aut._perm_num  # tag 'p'
    chk_qstate12(xsp2co1_set_elem_word(res._data, a, 2))
    return res
Exemplo n.º 2
0
 def xsp_conjugate(self, v, sign=True):
     v = np.array(v, dtype=np.uint64, copy=True)
     shape = v.shape
     assert len(shape) <= 1
     v = np.ravel(v)
     chk_qstate12(xsp2co1_xspecial_conjugate(self._data, len(v), v, sign))
     if len(shape):
         return list(map(int, v))
     else:
         return int(v[0])
Exemplo n.º 3
0
 def as_mmspace_vector(self, v1):
     vm = self.mmspace(0)
     assert v1.qs.shape == (12, 12)
     if INT_BITS == 64:
         START = 116416 // 32
         assert len(vm.data) >= START + 4096
         chk_qstate12(xsp2co1_elem_row_mod3(v1._data, 0, vm.data[START:]))
         return vm
     ERR = "Function not supported on %d-bit systems"
     raise NotImplementedError(ERR % INT_BITS)
Exemplo n.º 4
0
def xsp2co1_fast_half_order(wx):
    assert isinstance(wx, Xsp2_Co1)
    buf = np.zeros(10, dtype=np.uint32)
    m = MM0(wx)
    res = chk_qstate12(xsp2co1_half_order_word(m._data, m.length, buf))
    o, l = divmod(res, 256)
    assert 0 <= l <= 10
    out = Xsp2_Co1()
    chk_qstate12(xsp2co1_mul_elem_word(out._data, buf, l))
    return o, out
Exemplo n.º 5
0
 def dump_vector(self, v1):
     a = np.zeros(4096, dtype=np.uint64)
     chk_qstate12(xsp2co1_elem_row_mod3(v1._data, 0, a))
     or_sum = 0
     print("Xsp2_Co1 vector:")
     for i, x in enumerate(a):
         x = int(x) & 0xffffffffffff
         if (x):
             print("0x%04x: 0x%012x" % (i, x))
         or_sum |= x
     if not or_sum:
         print("Vector is equal to 0")
Exemplo n.º 6
0
def conj_G_x0_to_Q_x0(g):
    gg = Xsp2_Co1(g)
    a = np.zeros(7, dtype=np.uint32)
    lv = chk_qstate12(xsp2co1_elem_conj_G_x0_to_Q_x0(gg._data, a))
    length, q = lv >> 25, lv & 0x1ffffff
    h = MM0('a', a[:length])
    gh = MM0(g)**h
    assert gh.in_Q_x0()
    assert gh == MM0('q', q)
    return h
Exemplo n.º 7
0
    def conjugate_involution(self, mmgroup=None):
        r"""Find an element conjugating an involution standard element

        If the element :math:`g` given by ``self`` is an involution 
        in  the monster then the method computes an element :math:`h` 
        of the monster   with  :math:`h^{-1} g h = z`, where  
        :math:`z` is define as follows:

        If :math:`g = 1`, we put :math:`h = z = 1`

        if :math:`g` is a 2A involution (in the monster) then we let
        :math:`z` be the involution in  :math:`Q_{x0}` corresponding 
        to the Golay cocode word with entries  :math:`2,3` being set.

        if :math:`g` is a 2B involution (in the monster) then we let 
        :math:`z` be the central involution in :math:`G_{x0}`

        The function returns a pair ``(I, h)``, where :math:`h` as an 
        element of the instance  ``MM`` of class ``MMGroup``. We put
        ``I = 0`` if :math:`g = 1`. We put ``I = 1, 2`` if 
        :math:`g` is a 2A or 2B involution, respectively.

        The function raises ``ValueError`` if :math:`g` is not an 
        involution. 

        This is a wrapper for the C 
        function ``xsp2co1_elem_conjugate_involution``.

        Parameter ``mmgroup`` is not for public use. In special cases
        it may specify an alternative class implementing the monster 
        group. Then the function returns :math:`h` as an instance of 
        that class.
        """
        if mmgroup is None:
            mmgroup = MM if MM is not None else import_MM()
        a = np.zeros(15, dtype=np.uint32)
        len_a = xsp2co1_elem_conjugate_involution(self._data, a)
        chk_qstate12(len_a)
        return (len_a >> 8), mmgroup('a', a[:len_a & 0xff])
Exemplo n.º 8
0
 def from_xsp(self, x):
     w = self.word_type()
     chk_qstate12(xsp2co1_elem_xspecial(w._data, x))
     return w
Exemplo n.º 9
0
 def _equal_words(self, g1, g2):
     chk_qstate12(xsp2co1_reduce_elem(g1._data))
     chk_qstate12(xsp2co1_reduce_elem(g2._data))
     return (g1._data == g2._data).all()
Exemplo n.º 10
0
 def reduce(self, g1, copy=False):
     if copy:
         g1 = self.copy_word(g1)
     chk_qstate12(xsp2co1_reduce_elem(g1._data))
     return self
Exemplo n.º 11
0
 def _invert(self, g1):
     w = self.word_type()
     chk_qstate12(xsp2co1_inv_elem(g1._data, w._data))
     return w
Exemplo n.º 12
0
 def _imul(self, g1, g2):
     chk_qstate12(xsp2co1_mul_elem(g1._data, g2._data, g1._data))
     return g1
Exemplo n.º 13
0
def xsp2co1_fast_order(wx, via_word=True):
    assert isinstance(wx, Xsp2_Co1)
    if not via_word:
        return chk_qstate12(xsp2co1_order_elem(wx._data))
    m = MM0(wx)
    return xsp2co1_order_word(m._data, m.length)
Exemplo n.º 14
0
def reduce_word_C(w):
    a = np.array(w, dtype=np.uint32)
    a1 = np.zeros(10, dtype=np.uint32)
    len_a1 = chk_qstate12(xsp2co1_reduce_word(a, len(a), a1))
    return a1[:len_a1]
Exemplo n.º 15
0
def xsp2co1_fast_power(wx, e):
    """The safe exponentiation in G_x0 to be tested"""
    assert isinstance(wx, Xsp2_Co1)
    power = Xsp2_Co1()
    chk_qstate12(xsp2co1_power_elem(wx._data, e, power._data))
    return power
Exemplo n.º 16
0
def ploop_to_xsp2co1(g, pl):
    res = g.word_type(group=g)
    value = (c.value & 0x1fff)
    value = (value << 12) ^ mat24.ploop_theta(value)
    chk_qstate12(xsp2co1_elem_xspecial(res._data, value))
    return res
Exemplo n.º 17
0
def cocode_to_xsp2co1(g, c):
    res = g.word_type(group=g)
    chk_qstate12(xsp2co1_elem_xspecial(res._data, c.value & 0xfff))
    return res
Exemplo n.º 18
0
 def mmdata(self):
     a = np.zeros(10, dtype=np.uint32)
     length = chk_qstate12(xsp2co1_elem_to_word(self._data, a))
     return a[:length]
Exemplo n.º 19
0
 def imul_group_word(self, v1, g):
     if v1.is_zero:
         return v1
     chk_qstate12(xsp2co1_mul_elem(v1._data, g._data, v1._data))
     return v1
Exemplo n.º 20
0
def xsp2co1_to_mm(mmgroup, xsp):
    g = mmgroup()
    g._extend(10)
    g.length = chk_qstate12(xsp2co1_elem_to_word(xsp._data, g._data))
    g.reduced = 0
    return g
Exemplo n.º 21
0
 def reduce(self, v):
     if not v.is_zero:
         chk_qstate12(xsp2co1_reduce_elem(v._data))
     return v
Exemplo n.º 22
0
 def as_xsp(self):
     return chk_qstate12(xsp2co1_xspecial_vector(self._data))
Exemplo n.º 23
0
def mmgroup_to_xsp2co1(g, mm):
    res = g.word_type(group=g)
    chk_qstate12(xsp2co1_set_elem_word(res._data, mm._data, mm.length))
    return res
Exemplo n.º 24
0
def elem_to_word_C(elem):
    a = np.zeros(10, dtype=np.uint32)
    elem_data = np.array(elem.data, dtype=np.uint64)
    len_a = chk_qstate12(xsp2co1_elem_to_word(elem_data, a))
    return a[:len_a]