"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mpmath/calculus/optimization.py" between
mpmath-1.0.0.tar.gz and mpmath-1.1.0.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

optimization.py  (mpmath-1.0.0):optimization.py  (mpmath-1.1.0)
skipping to change at line 965 skipping to change at line 965
else: else:
maxsteps = iterations.maxsteps maxsteps = iterations.maxsteps
i = 0 i = 0
for x, error in iterations: for x, error in iterations:
if verbose: if verbose:
print_('x: ', x) print_('x: ', x)
print_('error:', error) print_('error:', error)
i += 1 i += 1
if error < tol * max(1, norm(x)) or i >= maxsteps: if error < tol * max(1, norm(x)) or i >= maxsteps:
break break
else:
if not i:
raise ValueError('Could not find root using the given solver.\n'
'Try another starting point or tweak arguments.
')
if not isinstance(x, (list, tuple, ctx.matrix)): if not isinstance(x, (list, tuple, ctx.matrix)):
xl = [x] xl = [x]
else: else:
xl = x xl = x
if verify and norm(f(*xl))**2 > tol: # TODO: better condition? if verify and norm(f(*xl))**2 > tol: # TODO: better condition?
raise ValueError('Could not find root within given tolerance. ' raise ValueError('Could not find root within given tolerance. '
'(%s > %s)\n' '(%s > %s)\n'
'Try another starting point or tweak arguments.' 'Try another starting point or tweak arguments.'
% (norm(f(*xl))**2, tol)) % (norm(f(*xl))**2, tol))
return x return x
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)