random-fu-0.2.4.0: Random number generation

Safe HaskellSafe-Inferred

Data.Random.Internal.Find

Synopsis

Documentation

findMax :: (Fractional a, Ord a) => (a -> Bool) -> aSource

findMin :: (Fractional a, Ord a) => (a -> Bool) -> aSource

Given an upward-closed predicate on an ordered Fractional type, find the smallest value satisfying the predicate.

findMinFrom :: (Fractional a, Ord a) => a -> a -> (a -> Bool) -> aSource

Given an upward-closed predicate on an ordered Fractional type, find the smallest value satisfying the predicate. Starts at the specified point with the specified stepsize, performs an exponential search out from there until it finds an interval bracketing the change-point of the predicate, and then performs a bisection search to isolate the change point. Note that infinitely-divisible domains such as Rational cannot be searched by this function because it does not terminate until it reaches a point where further subdivision of the interval has no effect.