Permalink
Browse files

BUG: work around complex to real casting in optimize.nonlin

Use a real initial guess in tests to trigger the problem.
See this discussion: http://mail.scipy.org/pipermail/scipy-user/2012-June/032404.html
  • Loading branch information...
1 parent 5f8c437 commit dfa7ae4239220a6b30207e365ca365b8f1324f30 @dlax dlax committed Jun 27, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 scipy/optimize/nonlin.py
  2. +1 −1 scipy/optimize/tests/test_nonlin.py
View
2 scipy/optimize/nonlin.py
@@ -311,7 +311,7 @@ def nonlin_solve(F, x0, jacobian='krylov', iter=None, verbose=False,
line_search)
else:
s = 1.0
- x += dx
+ x = x + dx
Fx = func(x)
Fx_norm_new = norm(Fx)
View
2 scipy/optimize/tests/test_nonlin.py
@@ -211,7 +211,7 @@ def _check(self, jac, N, maxiter, complex=False, **kw):
def func(x):
return dot(A, x) - b
- sol = nonlin.nonlin_solve(func, b*0, jac, maxiter=maxiter,
+ sol = nonlin.nonlin_solve(func, np.zeros(N), jac, maxiter=maxiter,
f_tol=1e-6, line_search=None, verbose=0)
assert_(np.allclose(dot(A, sol), b, atol=1e-6))

0 comments on commit dfa7ae4

Please sign in to comment.