Ticket #9239: trac_9239-matrix_copy_remove-fh.patch

File trac_9239-matrix_copy_remove-fh.patch, 1.7 KB (added by hivert, 11 years ago)
  • sage/matrix/matrix0.pyx

    # HG changeset patch
    # User Florent Hivert <Florent.Hivert@univ-rouen.fr>
    # Date 1276560701 -7200
    # Node ID 473e449d9e43bd165bfe0ff4c4a2a82fecdb7f52
    # Parent  5ff63bd154529813df142719943a2d57b179eed0
    #9239: remove wrong __copy__ method in matrix0.pyx
    
    diff --git a/sage/matrix/matrix0.pyx b/sage/matrix/matrix0.pyx
    a b cdef class Matrix(sage.structure.element 
    167167        sage.misc.misc.deprecation("the .copy() method is deprecated; please use the copy() function instead, for example, copy(M)")
    168168        return self.__copy__()
    169169
    170 
    171     def __copy__(self):
    172         """
    173         Make a copy of self. If self is immutable, the copy will be
    174         mutable.
    175        
    176         .. warning::
    177 
    178            The individual elements aren't themselves copied (though
    179            the list is copied). This shouldn't matter, since ring
    180            elements are (almost!) always immutable in Sage.
    181        
    182         EXAMPLES::
    183        
    184             sage: R.<x> = QQ['x']
    185             sage: a = matrix(R,2,[x+1,2/3,  x^2/2, 1+x^3]); a
    186             [  x + 1     2/3]
    187             [1/2*x^2 x^3 + 1]
    188             sage: b = copy(a)
    189             sage: b[0,0] = 5
    190             sage: b
    191             [      5     2/3]
    192             [1/2*x^2 x^3 + 1]
    193             sage: a
    194             [  x + 1     2/3]
    195             [1/2*x^2 x^3 + 1]
    196        
    197         ::
    198        
    199             sage: b = copy(a)
    200             sage: f = b[0,0]; f[0] = 10
    201             Traceback (most recent call last):
    202             ...
    203             IndexError: polynomials are immutable
    204         """
    205         return self.__copy__()
    206 
    207170    def list(self):
    208171        """
    209172        List of the elements of self ordered by elements in each