Ticket #8294: trac_8294-matrix_2x2_copy_mutability_fix-fh.patch

File trac_8294-matrix_2x2_copy_mutability_fix-fh.patch, 1.3 KB (added by hivert, 11 years ago)
  • sage/matrix/matrix_integer_2x2.pyx

    # HG changeset patch
    # User Florent Hivert <Florent.Hivert@univ-rouen.fr>
    # Date 1266421189 -3600
    # Node ID 9c852155db592a5b5b72494b092c9374f39b70e0
    # Parent  9079414de31b1d45dae13a6cd25aead06edc9181
    #8294: Copy is broken on 2x2 integer matrix (mutability is not set).
    
    diff --git a/sage/matrix/matrix_integer_2x2.pyx b/sage/matrix/matrix_integer_2x2.pyx
    a b include "../ext/python_ref.pxi" 
    1111from sage.rings.all import polygen, QQ,ZZ
    1212from sage.rings.integer cimport Integer
    1313from sage.structure.element cimport ModuleElement, Element
     14from sage.structure.mutability cimport Mutability
    1415
    1516cimport matrix_dense
    1617import matrix_dense
    cdef class Matrix_integer_2x2(matrix_den 
    298299            True
    299300            sage: n is m
    300301            False
     302            sage: m.is_mutable()
     303            True
     304            sage: n.is_mutable()
     305            True
    301306        """
    302307        cdef Matrix_integer_2x2 x
    303308        x = self._new_c()
    cdef class Matrix_integer_2x2(matrix_den 
    305310        mpz_set(x.b, self.b)
    306311        mpz_set(x.c ,self.c)
    307312        mpz_set(x.d, self.d)
     313        x._mutability = Mutability(False)
    308314        if self.subdivisions is not None:
    309315            x.subdivide(*self.get_subdivisions())
    310316        return x