[Scipy-svn] r7055 - trunk/scipy/optimize/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Sun Jan 16 03:14:25 EST 2011
Author: rgommers
Date: 2011-01-16 02:14:24 -0600 (Sun, 16 Jan 2011)
New Revision: 7055
Modified:
trunk/scipy/optimize/tests/test_linesearch.py
Log:
TST: fix test failure of line_search_wolfe1/2 on win32 with Python 2.7/3.1
The issue was numerical precision when comparing two float arrays. Largest
difference between actual and desired first derivate arrays was 3.5e-15.
Modified: trunk/scipy/optimize/tests/test_linesearch.py
===================================================================
--- trunk/scipy/optimize/tests/test_linesearch.py 2011-01-15 15:28:05 UTC (rev 7054)
+++ trunk/scipy/optimize/tests/test_linesearch.py 2011-01-16 08:14:24 UTC (rev 7055)
@@ -2,7 +2,7 @@
Tests for line search routines
"""
-from numpy.testing import assert_, assert_equal
+from numpy.testing import assert_, assert_equal, assert_array_almost_equal
import scipy.optimize.linesearch as ls
import numpy as np
@@ -82,7 +82,7 @@
def bind_index(func, idx):
# Remember Python's closure semantics!
return lambda *a, **kw: func(*a, **kw)[idx]
-
+
for name in sorted(dir(self)):
if name.startswith('_scalar_func_'):
value = getattr(self, name)
@@ -162,7 +162,7 @@
if s is None:
continue
assert_equal(fv, f(x + s*p))
- assert_equal(gv, fprime(x + s*p))
+ assert_array_almost_equal(gv, fprime(x + s*p), decimal=14)
if s < smax:
c += 1
assert_line_wolfe(x, p, s, f, fprime, err_msg=name)
@@ -183,7 +183,7 @@
assert_equal(ofv, f(x))
assert_equal(fv, f(x + s*p))
if gv is not None:
- assert_equal(gv, fprime(x + s*p))
+ assert_array_almost_equal(gv, fprime(x + s*p), decimal=14)
if s < smax:
c += 1
assert_line_wolfe(x, p, s, f, fprime, err_msg=name)
More information about the Scipy-svn
mailing list