Ticket #5241: trac_5241-matrix-gp-list.patch

File trac_5241-matrix-gp-list.patch, 2.0 KB (added by wdj, 11 years ago)

to be applied to sage-3.3.alpha6

  • sage/groups/matrix_gps/matrix_group.py

    # HG changeset patch
    # User David Joyner <wdjoyner@gmail.com>
    # Date 1234813348 18000
    # Node ID 6fb95f94f6aaa075171586279ebb45956c9bc412
    # Parent  e2138334f239b57533766f43fc9d06b49485f8aa
    D
    D
    D
    D
    D
    D
    D
    fixed the bug reported in trac # 5241. - wdj
    
    diff -r e2138334f239 -r 6fb95f94f6aa sage/groups/matrix_gps/matrix_group.py
    a b  
    411411            [2 1]]           
    412412            sage: G.list()[0] in G
    413413            True
     414            sage: M1 = matrix(ZZ,2,[[-1,0],[0,1]])
     415            sage: M2 = matrix(ZZ,2,[[1,0],[0,-1]])
     416            sage: M3 = matrix(ZZ,2,[[-1,0],[0,-1]])
     417            sage: MG = MatrixGroup([M1, M2, M3])
     418            sage: MG.list()
     419            [[-1  0]
     420            [ 0 -1], [-1  0]
     421            [ 0  1], [ 1  0]
     422            [ 0 -1], [1 0]
     423            [0 1]]
     424            sage: MG.list()[1]
     425            [-1  0]
     426            [ 0  1]
     427            sage: MG.list()[1].parent()
     428            Matrix group over Integer Ring with 3 generators:
     429             [[[-1, 0], [0, 1]], [[1, 0], [0, -1]], [[-1, 0], [0, -1]]]
    414430
    415431            sage: GL(2,ZZ).list()
    416432            Traceback (most recent call last):
     
    425441        if not self.is_finite():
    426442            raise ValueError, "group must be finite"
    427443
     444        MS = self.matrix_space()
     445        if not self.base_ring().is_field():
     446            s = self._gap_().Elements().str(use_file=True)
     447            es = eval(s)
     448            v = [MatrixGroupElement(MS(x), self, check=False) for x in es]
     449            self.__list = v
     450            return list(v)
     451
    428452        # Get basic properties of the field over which we are working
    429453        F = self.field_of_definition()
    430454        n = F.degree()
     
    448472
    449473        # Finally, create the matrix space in which all these matrices live,
    450474        # and make each element as a MatrixGroupElement.
    451         MS = self.matrix_space()
    452475        v = [MatrixGroupElement(MS(x), self, check=False) for x in v]
    453476        self.__list = v
    454477        return list(v)