package biocaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=486aeb3e552dabae85839e2af30d6c52
sha512=4ed2df0b7cbd80bd6e29bd8fee9d2dacd9379ad0f4ff142bd8e16ade3f1507f6cc7cbe4c614943b8feb8fa4705935695cb458606b0da813dbf255b1e566a43cf
doc/biocaml.unix/Biocaml_unix/Accu/index.html
Module Biocaml_unix.AccuSource
A datastructure (based on Hashtbl) to accumulate values.
An Accu.t can be seen as a generalized histogram: samples are mapped to bins, and each bin has a corresponding value which may be its size or its contents depending on the need.
Generic API
General type for accumulators: 'samples are mapped to 'bins, and the 'accumulated value for a 'bin is updated with an 'increment
val create :
?n:int ->
bin:('a -> 'b) ->
zero:'d ->
add:('c -> 'd -> 'd) ->
unit ->
('a, 'b, 'c, 'd) tcreate ~n ~zero ~bin ~add creates an accumulator, which maps instances to bins with bin, uses zero as a neutral element (that is the value associated to a bin before any value has been added to it) and updates the value of a bin with add. n is an estimation of the maximum number of bins.
add accu x y updates the value in accu for the bin of x by an increment y
get accu x returns the value associated to b in accu.
Counters and histograms
val product :
?filter:('a -> 'b -> bool) ->
('a -> 'b -> 'c) ->
'a list ->
'b list ->
('c * int) Stream.tproduct filter f l1 l2 computes an histogram of values returned by f when it is applied for all combinations of elements in l1 and l2 such that the predicate filter is true