Ticket #12020: 12020_review.patch

File 12020_review.patch, 3.3 KB (added by jdemeyer, 8 years ago)
  • sage/matrix/matrix_cyclo_dense.pyx

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1321347962 -3600
    # Node ID 4af44b8cb17cb899bae085b5139d1cc4dda19287
    # Parent  54fc237a4282465b2f9397d02d8d6aa37dff5aee
    Add more doctests, import Volker Braun's #12000 patch
    
    diff --git a/sage/matrix/matrix_cyclo_dense.pyx b/sage/matrix/matrix_cyclo_dense.pyx
    a b  
    117117    #def __dealloc__(self):
    118118    #    pass
    119119       
    120     def __init__(self, parent, entries, copy, coerce):
     120    def __init__(self, parent, entries=None, copy=True, coerce=True):
    121121        """
    122122        Initialize a newly created cyclotomic matrix.
    123123
    124124        INPUT:
    125             parent -- a matrix space over a cyclotomic field
    126             entries -- a list of entries or scalar
    127             coerce -- bool; if true entries are coerced to base ring
    128             copy -- bool; ignored due to underlying data structure
     125
     126        - ``parent`` -- a matrix space over a cyclotomic field
     127
     128        - ``entries`` -- a list of entries or scalar
     129
     130        - ``coerce`` -- boolean; if true entries are coerced to base
     131          ring
     132
     133        - ``copy`` -- boolean; ignored due to underlying data
     134          structure
    129135
    130136        EXAMPLES:
    131         This function is called implicitly when you create new cyclotomic
    132         dense matrices.
     137
     138        This function is called implicitly when you create new
     139        cyclotomic dense matrices::
     140
    133141            sage: W.<a> = CyclotomicField(100)
    134142            sage: A = matrix(2, 3, [1, 1/a, 1-a,a, -2/3*a, a^19])
    135143            sage: A
     
    137145            [                        a                    -2/3*a                      a^19]
    138146            sage: TestSuite(A).run()
    139147           
    140         TESTS:
     148        TESTS::
     149
    141150            sage: matrix(W, 2, 1, a)
    142151            Traceback (most recent call last):
    143152            ...
    144153            TypeError: nonzero scalar matrix must be square
    145154
    146         We call __init__ explicitly below.
     155        We call __init__ explicitly below::
     156
    147157            sage: from sage.matrix.matrix_cyclo_dense import Matrix_cyclo_dense
    148158            sage: A = Matrix_cyclo_dense.__new__(Matrix_cyclo_dense, MatrixSpace(CyclotomicField(3),2), [0,1,2,3], True, True)
    149159            sage: A.__init__(MatrixSpace(CyclotomicField(3),2), [0,1,2,3], True, True)
  • sage/matrix/matrix_space.py

    diff --git a/sage/matrix/matrix_space.py b/sage/matrix/matrix_space.py
    a b  
    400400
    401401        TESTS:
    402402
    403             Ensure that trac 12020 is fixed::
     403        Ensure that trac 12020 is fixed::
    404404
    405                 sage: A = MatrixSpace(CyclotomicField(4),60,30)(0)
    406                 sage: B = A.augment(A)
     405            sage: x = polygen(QQ)
     406            sage: for R in [ZZ, QQ, RealField(100), ComplexField(100), RDF, CDF, SR, GF(2), GF(11), GF(2^8,'a'), GF(3^19,'a'), NumberField(x^3+2,'a'), CyclotomicField(4), PolynomialRing(QQ,'x'), PolynomialRing(CC,2,'x')]:
     407            ...       A = MatrixSpace(R,60,30,sparse=False)(0)
     408            ...       B = A.augment(A)
     409            ...       A = MatrixSpace(R,60,30,sparse=True)(0)
     410            ...       B = A.augment(A)
    407411        """
    408412        if entries is None or entries == 0:
    409413            if self._copy_zero: # faster to copy than to create a new one.