# 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 Computes the left eigenspaces of a matrix of double precision real or complex numbers (i.e. RDF or CDF). .. warning:: This method returns eigenspaces that are all of dimension one, since it is impossible to ascertain if the numerical results belong to the same eigenspace. So this is deprecated in favor of the eigenmatrix routines, such as :meth:`sage.matrix.matrix2.Matrix.eigenmatrix_right`. INPUT: - ``var`` - ignored for numerical matrices by a sign. So for doctests we have normalized output by creating an eigenspace with a canonical basis. EXAMPLES:: EXAMPLES: This first test simply raises the deprecation warning.  :: sage: A = identity_matrix(RDF, 2) sage: es = A.eigenspaces_left() doctest:...: DeprecationWarning: Eigenspaces of RDF/CDF matrices are deprecated as of Sage version 5.0, please use "eigenmatrix_left" instead :: sage: m = matrix(RDF, [[-5, 3, 2, 8],[10, 2, 4, -2],[-1, -10, -10, -17],[-2, 7, 6, 13]]) sage: spectrum = m.eigenspaces_left() ... ValueError: algebraic_multiplicity must be set to False for double precision matrices """ from sage.misc.misc import deprecation msg = ('Eigenspaces of RDF/CDF matrices are deprecated as of ', 'Sage version 5.0', ', please use "eigenmatrix_left" instead') deprecation(''.join(msg)) # For numerical values we leave decisions about # multiplicity to the calling routine if algebraic_multiplicity: Computes the right eigenspaces of a matrix of double precision real or complex numbers (i.e. RDF or CDF). .. warning:: This method returns eigenspaces that are all of dimension one, since it is impossible to ascertain if the numerical results belong to the same eigenspace. So this is deprecated in favor of the eigenmatrix routines, such as :meth:`sage.matrix.matrix2.Matrix.eigenmatrix_right`. INPUT: - ``var`` - ignored for numerical matrices eigenspace with a canonical basis. EXAMPLES:: EXAMPLES: This first test simply raises the deprecation warning.  :: sage: A = identity_matrix(RDF, 2) sage: es = A.eigenspaces_right() doctest:...: DeprecationWarning: Eigenspaces of RDF/CDF matrices are deprecated as of Sage version 5.0, please use "eigenmatrix_right" instead :: sage: m = matrix(RDF, [[-9, -14, 19, -74],[-1, 2, 4, -11],[-4, -12, 6, -32],[0, -2, -1, 1]]) sage: m ... ValueError: algebraic_multiplicity must be set to False for double precision matrices """ from sage.misc.misc import deprecation msg = ('Eigenspaces of RDF/CDF matrices are deprecated as of ', 'Sage version 5.0', ', please use "eigenmatrix_right" instead') deprecation(''.join(msg)) # For numerical values we leave decisions about # multiplicity to the calling routine if algebraic_multiplicity:
• ## sage/modules/free_module.py

`diff --git a/sage/modules/free_module.py b/sage/modules/free_module.py`
 a (0, 0, 0, 1) sage: N((0,0,0,1), check=False) in N True Here is an example showing how the numerical instability causes trouble. The equality test below returns either True or False, depending on the architecture. :: sage: v = matrix(RDF, 3, range(9)).eigenspaces_left()[0][1].basis()[0] sage: v.complex_vector() (...0.440242867..., ...0.567868371..., ...0.695493875...) sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0] (...0.440242867..., ...0.567868371..., ...0.695493875...) sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0] == v.complex_vector() # random False sage: v.complex_vector().parent().echelonized_basis_matrix()[0] * v[0] - v.complex_vector() # random (0, -1.11022302463e-16, 0) """ if isinstance(x, (int, long, sage.rings.integer.Integer)) and x==0: return self.zero_vector()