• Jason Rhinelander's avatar
    New right/tolerance argument syntax; remove domain_t deduction · 6a75e5f5
    Jason Rhinelander authored
    This changes the `right` and `tolerance` argument into more complex
    objects that allow both a literal, or special objects returned by
    `search_right()`, `absolute_tolerance(.001)`, or
    `relative_tolerance(.1)`.
    
    This allows the much more descriptive syntax:
    
        constrained_maximum_search(f, 0, search_right(), relative_tolerance(.001))
    
    This also reintroduces the ability to specify an absolute tolerance
    level, which was there once (as a separate argument) but got lost along
    the way.
    
    This commit also changes the `domain_t` argument to be no longer
    deduced.  Previously it was deduced from `left`, which would have made
    the above example rather broken: `domain_t` would have been `int` (from
    the 0) rather than `double` (which would require 0.0).  Overriding
    `domain_t` now requires an explicitly template parameter:
    
        constrained_maximum_search<float>(f, 0, search_right(), relative_tolerance(.001))
    6a75e5f5
algorithms.hpp 29.8 KB