A function to halt computation when the number of iterations reaches a given threshold, tol
# S3 method for maxit
stopping(cost, curcost, count, tol, ...)
...
the value of the loss function passed in
current measure of cost, can be different to the parameter 'cost' above e.g. may consider smoothed cost over the last k iterations
iteration count
tolerance, or limit
additional arguments