Histograms with polymorphic bin types.
A histogram is a list of bins, each with a count. Bin i is
defined by a lower limit lo(i) and an upper limit hi(i). It is
inclusive of the lower limit and exclusive of the upper limit. For
all i, hi(i) = lo(i+1). By convention the first bin is
numbered 0. The count of a bin is a floating point number,
allowing fractional values if necessary.
module Biocaml_histogram: sigtype 'a t
'a.val make : ('a -> 'a -> int) -> 'a list -> 'a t optionmake cmp bins returns a new histogram from the given bins,
all initialized to a count of 0.0. The bins must be provided as a
list of the boundaries dividing them. The list [v0; v1; ...; vn]
of length n+1 represents the n bins [v0, v1), [v1, v2),
..., [vn-1, vn), where cmp is used as the comparison
function. Resturns None if bins are not monotonically
increasing, or if length of bins is less than 2.val to_list : 'a t -> (('a * 'a) * float) listval bin_exn : 'a t -> int -> 'a * 'abin hist i returns the ith bin of hist. Raise
Invalid_argument if an invalid bin number is requested.val count_exn : 'a t -> int -> floatcount hist i returns the count the ith bin. Raise
Invalid_argument if an invalid bin number is requested.val increment : ?delt:float -> 'a t -> 'a -> 'a t increment delt hist x increments the count of the bin containing
x by delt (default is 1.0). The histogram is unaltered if x not
in any bin. This is not considered an error because it is often
necessary to calculate a histogram for a subset of a larger data
set.val find_bin_index : 'a t -> 'a -> int optionfind_bin_index hist x returns the index of the bin in hist
containing x. Return None if x is outside the histogram's
range.val in_range : 'a t -> 'a -> boolin_range hist x is true if x greater than or equal to minimum
hist and strictly less than maximum hist.val make_uniform : float ->
float -> int -> (float t, string) Core.Std.Result.tmake_uniform min max n returns a histogram with n bins
uniformly dividing up the range from min to max. Bins will be
inclusive of the lower limit and exclusive of the upper limit,
i.e. value of min will fall into lowest bin and value of max will
fall outside the range of the histogram. Raise Failure if min not
strictly less than max or if n not greater than 0.end