Improvements to single_peak_search
- Added tol_abs parameter which defaults to 1e-20. - renamed existing tolerance parameter to tol_rel - Unrolled the recursion into a loop - Added check and fix for midleft > midright, which can happen when the optimum is close to 0. - Added check for numerical precision limit: if the calculated midpoint is not distinguishable from the endpoint, we're as good as it's going to get. (This, combined with the previous problem, could cause an infinite loop for an optimum at 0).
Showing with 75 additions and 42 deletions