random-fu-0.3.0.1: Random number generation

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Random.Internal.Find

Synopsis

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

# Documentation

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

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

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) -> a Source #

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.