anchor.diff:              else
                   s (i) = zero
               end if
  -110     continue
  +        end do
           itcsav = iterc
           go to 210
   !
  
positive.code: !
          sumpq = zero
          winc = zero
          do 20 k = 1, npt
              distsq = zero
              do 10 j = 1, n
                  xpt (k, j) = xpt (k, j) - xopt (j)
  10          distsq = distsq + xpt (k, j) ** 2
              sumpq = sumpq + pq (k)
              w (ndim+k) = distsq
              winc = max (winc, distsq)
              do 20 j = 1, nptm
  20      zmat (k, j) = zero
  !
  !     Update HQ so that HQ and PQ define the second derivatives of the model
  !     after XBASE has been shifted to the trust region centre.
  !
          ih = 0
          do 40 j = 1, n
              w (j) = half * sumpq * xopt (j)
              do 30 k = 1, npt
  30          w (j) = w (j) + pq (k) * xpt (k, j)
              do 40 i = 1, j
                  ih = ih + 1
  40      hq (ih) = hq (ih) + w (i) * xopt (j) + w (j) * xopt (i)
  !
  !     Shift XBASE, SL, SU and XOPT. Set the elements of BMAT to zero, and
  !     also set the elements of PTSAUX.
  !
          do 50 j = 1, n
              xbase (j) = xbase (j) + xopt (j)
              sl (j) = sl (j) - xopt (j)
              su (j) = su (j) - xopt (j)
  
negative.code:             else
                  s (i) = beta * s (i) - gnew (i)
              end if
              stepsq = stepsq + s (i) ** 2
          end do
          if (stepsq == zero) go to 190
          if (beta == zero) then
              gredsq = stepsq
  