def __call__(self, fun, initial_step_size, epsilon):
f0, g0 = fun(<NUM_LIT:0.0>, do_gradient=True)<EOL>gl = fun(-<NUM_LIT:0.5>*epsilon, do_gradient=True)[<NUM_LIT:1>]<EOL>gh = fun(+<NUM_LIT:0.5>*epsilon, do_gradient=True)[<NUM_LIT:1>]<EOL>h0 = (gh-gl)/epsilon<EOL>if h0 > <NUM_LIT:0>:<EOL><INDENT>q1, f1, g1, h1 = <NUM_LIT:0.0>, f0, g0, h0<EOL>counter = <NUM_LIT:0><EOL>wolfe = False<EOL>while True:<EOL><INDENT>q2 = q1-g1/h1<EOL>f2, g2 = fun(q2, do_gradient=True)<EOL>if abs(g2) > abs(g1) or f2 > f1:<EOL><INDENT>break<EOL><DEDENT>if self.qmax is not None and q2 > self.qmax:<EOL><INDENT>break<EOL><DEDENT>counter += <NUM_LIT:1><EOL>if self.max_iter is not None and counter > self.max_iter:<EOL><INDENT>break<EOL><DEDENT>q1, f1, g1 = q2, f2, g2<EOL>del q2<EOL>del f2<EOL>del g2<EOL>if f1 >= f0 + self.c1*abs(g0*q1):<EOL><INDENT>break<EOL><DEDENT>if f1 <= f0 - self.c1*abs(g0*q1) and abs(g1) <= abs(g0*self.c2):<EOL><INDENT>wolfe = True<EOL>break<EOL><DEDENT>gl = fun(q1-<NUM_LIT:0.5>*epsilon, do_gradient=True)[<NUM_LIT:1>]<EOL>gh = fun(q1+<NUM_LIT:0.5>*epsilon, do_gradient=True)[<NUM_LIT:1>]<EOL>h1 = (gh-gl)/epsilon<EOL><DEDENT>if counter > <NUM_LIT:0> and f1 <= f0:<EOL><INDENT>return True, wolfe, q1, f1<EOL><DEDENT>else:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if self.qmax is None:<EOL><INDENT>qmax = initial_step_size*<NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>qmax = min(initial_step_size*<NUM_LIT>, self.qmax)<EOL><DEDENT>q1 = -np.sign(g0)*qmax<EOL>counter = <NUM_LIT:0.0><EOL>while True:<EOL><INDENT>f1 = fun(q1)<EOL>if f1 < f0:<EOL><INDENT>return True, False, q1, f1<EOL><DEDENT>q1 *= <NUM_LIT:0.5><EOL>counter += <NUM_LIT:1><EOL>if self.max_iter is not None and counter > self.max_iter:<EOL><INDENT>return False, False, <NUM_LIT:0.0>, f0<EOL><DEDENT><DEDENT>
Return the value that minimizes the one-dimensional function 'fun'

           Arguments:
            | ``fun``  --  function to minimize (one-dimensional)
            | ``f0``   --  the function value at the starting point q=0"
            | ``initial_step_size``  --  a guess of the order of magnitude of
                                         step size to be found. This is used
                                         in case the default newton line search
                                         fails and when the routine reverts to
                                         backtracking as a last resort.
            | ``epsilon``  --  a value that is small compared to
                               initial_step_size

           Returns:
            | ``success``  --  a boolean indicating that the line search
                               resulted in an improved solution
            | ``wolfe``  --  a boolean indicating that the new solution
                             satisfies Wolfe conditions
            | ``qopt``  --  the position of the new solution on the line
            | ``fopt``  --  the corresponding function value