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

File trac_11603-deprecate-numerical-eigenspaces.patch, 5.0 KB (added by rbeezer, 10 years ago)
  • sage/matrix/matrix_double_dense.pyx

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1310799727 25200
    # Node ID 8b6afdafea6b423bf5e5458f68fa9076349cd2d1
    # Parent  2c5ad01c9e18f83ec0086dc382f60d5c8041f3b4
    11603: deprecate RDF/CDF eigenspaces
    
    diff --git a/sage/matrix/matrix_double_dense.pyx b/sage/matrix/matrix_double_dense.pyx
    a b  
    627627        Computes the left eigenspaces of a matrix of double precision
    628628        real or complex numbers (i.e. RDF or CDF).
    629629
     630        .. warning::
     631
     632            This method returns eigenspaces that are all of
     633            dimension one, since it is impossible to ascertain
     634            if the numerical results belong to the same eigenspace.
     635            So this is deprecated in favor of the eigenmatrix routines,
     636            such as :meth:`sage.matrix.matrix2.Matrix.eigenmatrix_right`.
     637
    630638        INPUT:
    631639
    632640        - ``var`` - ignored for numerical matrices
     
    647655        by a sign. So for doctests we have normalized output by creating an
    648656        eigenspace with a canonical basis.
    649657
    650         EXAMPLES::
     658        EXAMPLES:
     659
     660        This first test simply raises the deprecation warning.  ::
     661
     662            sage: A = identity_matrix(RDF, 2)
     663            sage: es = A.eigenspaces_left()
     664            doctest:...: DeprecationWarning: Eigenspaces of RDF/CDF matrices are
     665            deprecated as of Sage version 4.7.2,
     666            please use "eigenmatrix_left" instead
     667
     668        ::
    651669
    652670            sage: m = matrix(RDF, [[-5, 3, 2, 8],[10, 2, 4, -2],[-1, -10, -10, -17],[-2, 7, 6, 13]])
    653671            sage: spectrum = m.eigenspaces_left()
     
    671689            ...
    672690            ValueError: algebraic_multiplicity must be set to False for double precision matrices
    673691        """
     692        from sage.misc.misc import deprecation
     693        msg = ('Eigenspaces of RDF/CDF matrices are deprecated as of ',
     694               'Sage version 4.7.2',
     695               ', please use "eigenmatrix_left" instead')
     696        deprecation(''.join(msg))
    674697        # For numerical values we leave decisions about
    675698        # multiplicity to the calling routine
    676699        if algebraic_multiplicity:
     
    690713        Computes the right eigenspaces of a matrix of double precision
    691714        real or complex numbers (i.e. RDF or CDF).
    692715
     716        .. warning::
     717
     718            This method returns eigenspaces that are all of
     719            dimension one, since it is impossible to ascertain
     720            if the numerical results belong to the same eigenspace.
     721            So this is deprecated in favor of the eigenmatrix routines,
     722            such as :meth:`sage.matrix.matrix2.Matrix.eigenmatrix_right`.
     723
    693724        INPUT:
    694725
    695726        - ``var`` - ignored for numerical matrices
     
    711742        eigenspace with a canonical basis.
    712743
    713744
    714         EXAMPLES::
     745        EXAMPLES:
     746
     747        This first test simply raises the deprecation warning.  ::
     748
     749            sage: A = identity_matrix(RDF, 2)
     750            sage: es = A.eigenspaces_right()
     751            doctest:...: DeprecationWarning: Eigenspaces of RDF/CDF matrices are
     752            deprecated as of Sage version 4.7.2,
     753            please use "eigenmatrix_right" instead
     754
     755        ::
    715756
    716757            sage: m = matrix(RDF, [[-9, -14, 19, -74],[-1, 2, 4, -11],[-4, -12, 6, -32],[0, -2, -1, 1]])
    717758            sage: m
     
    740781            ...
    741782            ValueError: algebraic_multiplicity must be set to False for double precision matrices
    742783        """
     784        from sage.misc.misc import deprecation
     785        msg = ('Eigenspaces of RDF/CDF matrices are deprecated as of ',
     786               'Sage version 4.7.2',
     787               ', please use "eigenmatrix_right" instead')
     788        deprecation(''.join(msg))
    743789        # For numerical values we leave decisions about
    744790        # multiplicity to the calling routine
    745791        if algebraic_multiplicity:
  • sage/modules/free_module.py

    diff --git a/sage/modules/free_module.py b/sage/modules/free_module.py
    a b  
    810810            sage: N((0,0,0,1), check=False) in N
    811811            True
    812812       
    813         Here is an example showing how the numerical instability causes
    814         trouble. The equality test below returns either True or False,
    815         depending on the architecture.
    816        
    817         ::
    818        
    819             sage: v = matrix(RDF, 3, range(9)).eigenspaces()[0][1].basis()[0]
    820             sage: v.complex_vector()
    821             (...0.440242867..., ...0.567868371..., ...0.695493875...)
    822             sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0]
    823             (...0.440242867..., ...0.567868371..., ...0.695493875...)
    824             sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0] == v.complex_vector() # random
    825             False
    826             sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0] - v.complex_vector() # random
    827             (0, -1.11022302463e-16, 0)
    828813        """
    829814        if isinstance(x, (int, long, sage.rings.integer.Integer)) and x==0:
    830815            return self.zero_vector()