/usr/lib/python2.7/dist-packages/openopt/solvers/scipy_optim/scipy_anderson2_oo.py is in python-openopt 0.38+svn1589-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | from scipy.optimize import anderson2
from numpy import asfarray
from openopt.kernel.baseSolver import baseSolver
class scipy_anderson2(baseSolver):
__name__ = 'scipy_anderson2'
__license__ = "BSD"
#__authors__ =
#__alg__ = ""
__info__ = """
solves system of n non-linear equations with n variables.
"""
def __init__(self):pass
def __solver__(self, p):
p.xk = p.x0.copy()
p.fk = asfarray(max(abs(p.f(p.x0)))).flatten()
p.iterfcn()
if p.istop:
p.xf, p.ff = p.xk, p.fk
return
try: xf = anderson2(p.f, p.x0, iter = p.maxIter)
except:
p.istop = -1000
return
p.xk = p.xf = asfarray(xf)
p.fk = p.ff = asfarray(max(abs(p.f(xf)))).flatten()
p.istop = 1000
p.iterfcn()
|