[sagemath] 01/01: Fix 15/16 of test failures in sage/symbolic/expression.pyx

Ximin Luo infinity0 at debian.org
Sun Oct 2 23:19:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository sagemath.

commit 1931d031f92c182a1db8aa0b65ba689bec44c0c1
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Oct 3 01:18:56 2016 +0200

    Fix 15/16 of test failures in sage/symbolic/expression.pyx
---
 debian/patches/fixsage-proper-scipy-rtol.patch | 52 ++++++++++++++++++++++++++
 debian/patches/series                          |  1 +
 2 files changed, 53 insertions(+)

diff --git a/debian/patches/fixsage-proper-scipy-rtol.patch b/debian/patches/fixsage-proper-scipy-rtol.patch
new file mode 100644
index 0000000..425f83c
--- /dev/null
+++ b/debian/patches/fixsage-proper-scipy-rtol.patch
@@ -0,0 +1,52 @@
+Description: Fix Sage's use of scipy rtol parameter
+ The scipy documentation very clearly says: 
+ "The parameter cannot be smaller than its default value of
+ ``4*np.finfo(float).eps``" so use that instead of a hard-coded value.
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: TBD
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/sage/src/sage/numerical/optimize.py
++++ b/sage/src/sage/numerical/optimize.py
+@@ -14,8 +14,11 @@
+ from sage.modules.free_module_element import vector
+ from sage.rings.real_double import RDF
+ 
++from numpy import finfo
++default_rtol = 4*finfo(float).eps
+ 
+-def find_root(f, a, b, xtol=10e-13, rtol=4.5e-16, maxiter=100, full_output=False):
++
++def find_root(f, a, b, xtol=10e-13, rtol=default_rtol, maxiter=100, full_output=False):
+     """
+     Numerically find a root of ``f`` on the closed interval `[a,b]`
+     (or `[b,a]`) if possible, where ``f`` is a function in the one variable.
+--- a/sage/src/sage/symbolic/expression.pyx
++++ b/sage/src/sage/symbolic/expression.pyx
+@@ -10884,7 +10886,7 @@
+             ret = ret[0]
+         return ret
+ 
+-    def find_root(self, a, b, var=None, xtol=10e-13, rtol=4.5e-16, maxiter=100, full_output=False):
++    def find_root(self, a, b, var=None, xtol=10e-13, rtol=0, maxiter=100, full_output=False):
+         """
+         Numerically find a root of self on the closed interval [a,b] (or
+         [b,a]) if possible, where self is a function in the one variable.
+@@ -11000,7 +11002,7 @@
+         """
+         if is_a_relational(self._gobj) and self.operator() is not operator.eq:
+             raise ValueError("Symbolic equation must be an equality.")
+-        from sage.numerical.optimize import find_root
++        from sage.numerical.optimize import find_root, default_rtol
+         if self.number_of_arguments() == 0:
+             if bool(self == 0):
+                 return a
+@@ -11009,7 +11011,7 @@
+         elif self.number_of_arguments() == 1:
+             f = self._fast_float_(self.default_variable())
+             return find_root(f, a=a, b=b, xtol=xtol,
+-                             rtol=rtol,maxiter=maxiter,
++                             rtol=(rtol or default_rtol),maxiter=maxiter,
+                              full_output=full_output)
+         else:
+             raise NotImplementedError("root finding currently only implemented in 1 dimension.")
diff --git a/debian/patches/series b/debian/patches/series
index c553ab0..c06d10c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,6 +8,7 @@ fixsage-mpfi.patch
 fixsage-sphinx.patch
 fixsage-libgap-systemwide.patch
 fixsage-use-lexists-not-exists.patch
+fixsage-proper-scipy-rtol.patch
 
 # due to us using a different version of a dependency than what Sage uses
 # we'll probably drop these when importing the next version of Sage

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagemath.git



More information about the debian-science-commits mailing list