class_docstr: Solve f(x, *args) == 0 using Algorithm748 of Alefeld, Potro & Shi.
      
class_docstr_tok: ["Solve","f","(","x",",","*","args",")","==","0","using","Algorithm748","of","Alefeld",",","Potro","&","Shi","."]
docstr: Perform one step in the algorithm.
  
  Implements Algorithm 4.1(k=1) or 4.2(k=2) in [APS1995]
docstr_tok: ["Perform","one","step","in","the","algorithm",".","Implements","Algorithm","4.1","(","k=1",")","or","4.2","(","k=2",")","in","[","APS1995","]"]
code: def iterate(self):
      """Perform one step in the algorithm.
  
      Implements Algorithm 4.1(k=1) or 4.2(k=2) in [APS1995]
      """
      self.iterations += 1
      eps = np.finfo(float).eps
      d, fd, e, fe = self.d, self.fd, self.e, self.fe
      ab_width = self.ab[1] - self.ab[0]  # Need the start width below
      c = None
  
      for nsteps in range(2, self.k + 2):
          # If the f-values are sufficiently separated, perform an inverse
          # polynomial interpolation step. Otherwise, nsteps repeats of
          # an approximate Newton-Raphson step.
          if _notclose(self.fab + [fd, fe], rtol=0, atol=32 * eps):
              c0 = _inverse_poly_zero(
                  self.ab[0],
                  self.ab[1],
                  d,
                  e,
                  self.fab[0],
                  self.fab[1],
                  fd,
                  fe,
              )
              if self.ab[0] < c0 < self.ab[1]:
                  c = c0
          if c is None:
              c = _newton_quadratic(self.ab, self.fab, d, fd, nsteps)
  
          fc = self._callf(c)
          if fc == 0:
              return _ECONVERGED, c
  
          # re-bracket
          e, fe = d, fd
          d, fd = self._update_bracket(c, fc)
  
      # u is the endpoint with the smallest f-value
      uix = 0 if np.abs(self.fab[0]) < np.abs(self.fab[1]) else 1
      u, fu = self.ab[uix], self.fab[uix]
  
      _, A = _compute_divided_differences(
          self.ab, self.fab, forward=(uix == 0), full=False
      )
      c = u - 2 * fu / A
      if np.abs(c - u) > 0.5 * (self.ab[1] - self.ab[0]):
          c = sum(self.ab) / 2.0
      else:
          if np.isclose(c, u, rtol=eps, atol=0):
              # c didn't change (much).
              # Either because the f-values at the endpoints have vastly
              # differing magnitudes, or because the root is very close to
              # that endpoint
              frs = np.frexp(self.fab)[1]
              if (
                  frs[uix] < frs[1 - uix] - 50
              ):  # Differ by more than 2**50
                  c = (31 * self.ab[uix] + self.ab[1 - uix]) / 32
              else:
                  # Make a bigger adjustment, about the
                  # size of the requested tolerance.
                  mm = 1 if uix == 0 else -1
                  adj = mm * np.abs(c) * self.rtol + mm * self.xtol
                  c = u + adj
              if not self.ab[0] < c < self.ab[1]:
                  c = sum(self.ab) / 2.0
  
      fc = self._callf(c)
      if fc == 0:
          return _ECONVERGED, c
  
      e, fe = d, fd
      d, fd = self._update_bracket(c, fc)
  
      # If the width of the new interval did not decrease enough, bisect
      if self.ab[1] - self.ab[0] > self._MU * ab_width:
          e, fe = d, fd
          z = sum(self.ab) / 2.0
          fz = self._callf(z)
          if fz == 0:
              return _ECONVERGED, z
          d, fd = self._update_bracket(z, fz)
  
      # Record d and e for next iteration
      self.d, self.fd = d, fd
      self.e, self.fe = e, fe
  
      status, xn = self.get_status()
      return status, xn
  
imports: import warnings
  from collections import namedtuple
  import operator
  from .None import _zeros
  from ._optimize import OptimizeResult, _call_callback_maybe_halt
  import numpy
label_desc: Use image node_id 8 for calling the TOMS748Solver obj's underlying member method code with example usage: obj.iterate() and returns: status,  xn, _ECONVERGED,  c, _ECONVERGED,  c, _ECONVERGED,  z