Ticket #5241: trac_5241-rebased.patch

File trac_5241-rebased.patch, 2.2 KB (added by AlexGhitza, 11 years ago)

rebased against 4.0

  • sage/groups/matrix_gps/matrix_group.py

    # HG changeset patch
    # User David Joyner <wdjoyner@gmail.com>
    # Date 1243775593 -36000
    # Node ID e91fe5c60f3b4ace6bf9d9a76e25d9f27cce4ee6
    # Parent  fd89fee664d87b20ab77bb6e248d9a71c17affe4
    fixed the bug reported in trac # 5241. - wdj                                                                                                   
    
    diff -r fd89fee664d8 -r e91fe5c60f3b sage/groups/matrix_gps/matrix_group.py
    a b  
    451451            [2 1]]           
    452452            sage: G.list()[0] in G
    453453            True
    454        
     454
     455        An example over a ring (see trac 5241)::
     456
     457            sage: M1 = matrix(ZZ,2,[[-1,0],[0,1]])
     458            sage: M2 = matrix(ZZ,2,[[1,0],[0,-1]])
     459            sage: M3 = matrix(ZZ,2,[[-1,0],[0,-1]])
     460            sage: MG = MatrixGroup([M1, M2, M3])
     461            sage: MG.list()
     462            [[-1  0]
     463            [ 0 -1], [-1  0]
     464            [ 0  1], [ 1  0]
     465            [ 0 -1], [1 0]
     466            [0 1]]
     467            sage: MG.list()[1]
     468            [-1  0]
     469            [ 0  1]
     470            sage: MG.list()[1].parent()
     471            Matrix group over Integer Ring with 3 generators:
     472            [[[-1, 0], [0, 1]], [[1, 0], [0, -1]], [[-1, 0], [0, -1]]]
     473
    455474        ::
    456475       
    457476            sage: GL(2,ZZ).list()
     
    467486        if not self.is_finite():
    468487            raise ValueError, "group must be finite"
    469488
     489        MS = self.matrix_space()
     490        if not self.base_ring().is_field():
     491            s = self._gap_().Elements().str(use_file=True)
     492            es = eval(s)
     493            v = [MatrixGroupElement(MS(x), self, check=False) for x in es]
     494            self.__list = v
     495            return list(v)
     496
    470497        # Get basic properties of the field over which we are working
    471498        F = self.field_of_definition()
    472499        n = F.degree()
     
    490517
    491518        # Finally, create the matrix space in which all these matrices live,
    492519        # and make each element as a MatrixGroupElement.
    493         MS = self.matrix_space()
    494520        v = [MatrixGroupElement(MS(x), self, check=False) for x in v]
    495521        self.__list = v
    496522        return list(v)