Module Measure.Causal_states.Clustering


module Clustering: sig .. end
Merge probability distributions.

module Cluster_collection: Queue
LIFO; Can be changed to Stack (FIFO).

type cluster = {
   id : int; (*a unique causal_state identifier*)
   distribution : int array; (*distribution.(i) is the number of points which plc belongs to this cluster and with the flc number i*)
   mutable nb_samples : int; (*= Array.fold_left (+) 0 distribution*)
}
type clusters = {
   mutable clusters : cluster
Cluster_collection.t
;
   id_generator : unit -> int; (*to create a new cluster*)
}
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.