Exemplo n.º 1
0
    def __setstate__(self, state):
        """
        Restore from old pickle.

        EXAMPLES::

            sage: from sage.groups.matrix_gps.pickling_overrides import LegacyMatrixGroup
            sage: state = dict()
            sage: state['_MatrixGroup_gap__n'] = 2
            sage: state['_MatrixGroup_gap__R'] = GF(3)
            sage: state['_gensG'] = [ matrix(GF(3), [[1,2],[0,1]]) ]
            sage: M = LegacyMatrixGroup.__new__(LegacyMatrixGroup)
            sage: M.__setstate__(state)
            sage: M
            Matrix group over Finite Field of size 3 with 1 generators (
            [1 2]
            [0 1]
            )
        """
        matrix_gens = state['_gensG']
        ring = state['_MatrixGroup_gap__R']
        degree = state['_MatrixGroup_gap__n']
        from sage.libs.all import libgap
        libgap_group = libgap.Group(libgap(matrix_gens))
        self.__init__(degree, ring, libgap_group)
Exemplo n.º 2
0
    def __setstate__(self, state):
        """
        Restore from old pickle.

        EXAMPLES::

            sage: from sage.groups.matrix_gps.pickling_overrides import LegacyMatrixGroup
            sage: state = dict()
            sage: state['_MatrixGroup_gap__n'] = 2
            sage: state['_MatrixGroup_gap__R'] = GF(3)
            sage: state['_gensG'] = [ matrix(GF(3), [[1,2],[0,1]]) ]
            sage: M = LegacyMatrixGroup.__new__(LegacyMatrixGroup)
            sage: M.__setstate__(state)
            sage: M
            Matrix group over Finite Field of size 3 with 1 generators (
            [1 2]
            [0 1]
            )
        """
        matrix_gens = state['_gensG']
        ring = state['_MatrixGroup_gap__R']
        degree = state['_MatrixGroup_gap__n']
        from sage.libs.all import libgap
        libgap_group = libgap.Group(libgap(matrix_gens))
        self.__init__(degree, ring, libgap_group)
Exemplo n.º 3
0
def test_loop_3():
    """
    EXAMPLES::

        sage: from sage.libs.gap.test_long import test_loop_3
        sage: test_loop_3()
    """
    G = libgap.FreeGroup(2)
    (a,b) = G.GeneratorsOfGroup()
    for i in range(300000):
        lis=libgap([])
        lis.Add(a ** 2)
        lis.Add(b ** 2)
        lis.Add(b * a)
Exemplo n.º 4
0
def test_loop_3():
    """
    EXAMPLES::

        sage: from sage.libs.gap.test_long import test_loop_3
        sage: test_loop_3()  # long time (31s on sage.math, 2013)
    """
    G = libgap.FreeGroup(2)
    (a, b) = G.GeneratorsOfGroup()
    for i in range(300000):
        lis = libgap([])
        lis.Add(a**2)
        lis.Add(b**2)
        lis.Add(b * a)
Exemplo n.º 5
0
def test_loop_2():
    """
    EXAMPLES::

        sage: from sage.libs.gap.test_long import test_loop_2
        sage: test_loop_2()
    """
    G =libgap.FreeGroup(2)
    a,b = G.GeneratorsOfGroup()
    for i in range(100):
        rel = libgap([a**2, b**2, a*b*a*b])
        H = G / rel
        H1 = H.GeneratorsOfGroup()[0]
        n = H1.Order()
        assert n.sage() == 2

    for i in range(300000):
        n = libgap.Order(H1)
Exemplo n.º 6
0
def test_loop_2():
    """
    EXAMPLES::

        sage: from sage.libs.gap.test_long import test_loop_2
        sage: test_loop_2()  # long time (10s on sage.math, 2013)
    """
    G = libgap.FreeGroup(2)
    a, b = G.GeneratorsOfGroup()
    for i in range(100):
        rel = libgap([a**2, b**2, a * b * a * b])
        H = G / rel
        H1 = H.GeneratorsOfGroup()[0]
        n = H1.Order()
        assert n.sage() == 2

    for i in range(300000):
        n = libgap.Order(H1)