Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Fix numerical noise
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Oct 16, 2014
1 parent 9876879 commit f30a982
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/sage/matrix/matrix2.pyx
Expand Up @@ -5206,10 +5206,10 @@ cdef class Matrix(matrix1.Matrix):
consult numerical or symbolic matrix classes for other options

sage: em = B.change_ring(RDF).eigenmatrix_right()
sage: eigenvalues = em[0]; eigenvalues.dense_matrix().zero_at(1e-15)
[ 13.348469228349... 0.0 0.0]
[ 0.0 -1.348469228349... 0.0]
[ 0.0 0.0 0.0]
sage: eigenvalues = em[0]; eigenvalues.dense_matrix() # abs tol 1e-13
[13.348469228349522 0.0 0.0]
[ 0.0 -1.348469228349534 0.0]
[ 0.0 0.0 0.0]
sage: eigenvectors = em[1]; eigenvectors # not tested
[ 0.164763817... 0.799699663... 0.408248290...]
[ 0.505774475... 0.104205787... -0.816496580...]
Expand Down Expand Up @@ -5686,10 +5686,10 @@ cdef class Matrix(matrix1.Matrix):

sage: B = matrix(QQ, 3, 3, range(9))
sage: em = B.change_ring(RDF).eigenmatrix_right()
sage: evalues = em[0]; evalues.dense_matrix().zero_at(2e-15)
[ 13.348469228349... 0.0 0.0]
[ 0.0 -1.348469228349... 0.0]
[ 0.0 0.0 0.0]
sage: evalues = em[0]; evalues.dense_matrix() # abs tol 1e-13
[13.348469228349522 0.0 0.0]
[ 0.0 -1.348469228349534 0.0]
[ 0.0 0.0 0.0]
sage: evectors = em[1];
sage: for i in range(3):
....: scale = evectors[0,i].sign()
Expand Down Expand Up @@ -12204,8 +12204,8 @@ cdef class Matrix(matrix1.Matrix):
sage: Id.norm(2)
1.0
sage: A = matrix(RR, 2, 2, [13,-4,-4,7])
sage: A.norm()
15.0
sage: A.norm() # rel tol 2e-16
14.999999999999998

Norms of numerical matrices over high-precision reals are computed by this routine.
Faster routines for double precision entries from `RDF` or `CDF` are provided by
Expand Down

0 comments on commit f30a982

Please sign in to comment.