Ticket #11603: trac_11603-deprecate-numerical-eigenspaces.2.patch

File trac_11603-deprecate-numerical-eigenspaces.2.patch, 5.1 KB (added by ppurka, 9 years ago)

Apply to devel/sage (Updated to sage-5.0)

  • sage/matrix/matrix_double_dense.pyx

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1310799727 25200
    # Node ID e489c36a13227f77c553611547d1b26efdeaa3eb
    # Parent  0bae00abf2731eb6ed239d8781ef86ecc202b59d
    deprecate RDF/CDF eigenspaces
    
    diff --git a/sage/matrix/matrix_double_dense.pyx b/sage/matrix/matrix_double_dense.pyx
    a b  
    12751275        Computes the left eigenspaces of a matrix of double precision
    12761276        real or complex numbers (i.e. RDF or CDF).
    12771277
     1278        .. warning::
     1279
     1280            This method returns eigenspaces that are all of
     1281            dimension one, since it is impossible to ascertain
     1282            if the numerical results belong to the same eigenspace.
     1283            So this is deprecated in favor of the eigenmatrix routines,
     1284            such as :meth:`sage.matrix.matrix2.Matrix.eigenmatrix_right`.
     1285
    12781286        INPUT:
    12791287
    12801288        - ``var`` - ignored for numerical matrices
     
    12951303        by a sign. So for doctests we have normalized output by creating an
    12961304        eigenspace with a canonical basis.
    12971305
    1298         EXAMPLES::
     1306        EXAMPLES:
     1307
     1308        This first test simply raises the deprecation warning.  ::
     1309
     1310            sage: A = identity_matrix(RDF, 2)
     1311            sage: es = A.eigenspaces_left()
     1312            doctest:...: DeprecationWarning: Eigenspaces of RDF/CDF matrices are
     1313            deprecated as of Sage version 5.0,
     1314            please use "eigenmatrix_left" instead
     1315
     1316        ::
    12991317
    13001318            sage: m = matrix(RDF, [[-5, 3, 2, 8],[10, 2, 4, -2],[-1, -10, -10, -17],[-2, 7, 6, 13]])
    13011319            sage: spectrum = m.eigenspaces_left()
     
    13191337            ...
    13201338            ValueError: algebraic_multiplicity must be set to False for double precision matrices
    13211339        """
     1340        from sage.misc.misc import deprecation
     1341        msg = ('Eigenspaces of RDF/CDF matrices are deprecated as of ',
     1342               'Sage version 5.0',
     1343               ', please use "eigenmatrix_left" instead')
     1344        deprecation(''.join(msg))
    13221345        # For numerical values we leave decisions about
    13231346        # multiplicity to the calling routine
    13241347        if algebraic_multiplicity:
     
    13381361        Computes the right eigenspaces of a matrix of double precision
    13391362        real or complex numbers (i.e. RDF or CDF).
    13401363
     1364        .. warning::
     1365
     1366            This method returns eigenspaces that are all of
     1367            dimension one, since it is impossible to ascertain
     1368            if the numerical results belong to the same eigenspace.
     1369            So this is deprecated in favor of the eigenmatrix routines,
     1370            such as :meth:`sage.matrix.matrix2.Matrix.eigenmatrix_right`.
     1371
    13411372        INPUT:
    13421373
    13431374        - ``var`` - ignored for numerical matrices
     
    13591390        eigenspace with a canonical basis.
    13601391
    13611392
    1362         EXAMPLES::
     1393        EXAMPLES:
     1394
     1395        This first test simply raises the deprecation warning.  ::
     1396
     1397            sage: A = identity_matrix(RDF, 2)
     1398            sage: es = A.eigenspaces_right()
     1399            doctest:...: DeprecationWarning: Eigenspaces of RDF/CDF matrices are
     1400            deprecated as of Sage version 5.0,
     1401            please use "eigenmatrix_right" instead
     1402
     1403        ::
    13631404
    13641405            sage: m = matrix(RDF, [[-9, -14, 19, -74],[-1, 2, 4, -11],[-4, -12, 6, -32],[0, -2, -1, 1]])
    13651406            sage: m
     
    13881429            ...
    13891430            ValueError: algebraic_multiplicity must be set to False for double precision matrices
    13901431        """
     1432        from sage.misc.misc import deprecation
     1433        msg = ('Eigenspaces of RDF/CDF matrices are deprecated as of ',
     1434               'Sage version 5.0',
     1435               ', please use "eigenmatrix_right" instead')
     1436        deprecation(''.join(msg))
    13911437        # For numerical values we leave decisions about
    13921438        # multiplicity to the calling routine
    13931439        if algebraic_multiplicity:
  • sage/modules/free_module.py

    diff --git a/sage/modules/free_module.py b/sage/modules/free_module.py
    a b  
    830830            (0, 0, 0, 1)
    831831            sage: N((0,0,0,1), check=False) in N
    832832            True
    833        
    834         Here is an example showing how the numerical instability causes
    835         trouble. The equality test below returns either True or False,
    836         depending on the architecture.
    837        
    838         ::
    839        
    840             sage: v = matrix(RDF, 3, range(9)).eigenspaces_left()[0][1].basis()[0]
    841             sage: v.complex_vector()
    842             (...0.440242867..., ...0.567868371..., ...0.695493875...)
    843             sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0]
    844             (...0.440242867..., ...0.567868371..., ...0.695493875...)
    845             sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0] == v.complex_vector() # random
    846             False
    847             sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0] - v.complex_vector() # random
    848             (0, -1.11022302463e-16, 0)
    849833        """
    850834        if isinstance(x, (int, long, sage.rings.integer.Integer)) and x==0:
    851835            return self.zero_vector()