module Clustering: sig
.. end
Merge probability distributions.
module Cluster_collection: Queue
LIFO; Can be changed to Stack
(FIFO).
type
cluster = {
|
id : int ; |
|
distribution : int array ; |
|
mutable nb_samples : int ; |
}
type
clusters = {
|
mutable clusters : cluster Cluster_collection.t ; |
|
id_generator : unit -> int ; |
}
val merge : cluster -> int array -> int -> unit
merges distribution
into cluster
,
assuming that Array.fold_left (+) 0 distribution = nb_samples_distribution
val create_clusters : unit -> clusters
Create an empty cluster collection.
exception Found of int
val add : clusters ->
(int array -> int -> int array -> int -> bool) -> int array -> int -> int
Affects the distribution to a cluster and returns the id of the latter.
Creates a new cluster if no cluster match distribution
according to test
val nb_samples : clusters -> int array
nb_samples clusters
.(i) is the nb of samples of the cluster with id i.
A sample is a pair (plc,flc), there are as many samples as
cells in the lattice far enough from the boundary.