package gsl

  1. Overview
  2. Docs

Histograms

type t = private {
  1. n : int;
    (*

    number of histogram bins

    *)
  2. range : float array;
    (*

    ranges of the bins ; n+1 elements

    *)
  3. bin : float array;
    (*

    counts for each bin ; n elements

    *)
}

The histogram type

val check : t -> bool

Allocating histograms

val make : int -> t
val copy : t -> t
val set_ranges : t -> float array -> unit
val set_ranges_uniform : t -> xmin:float -> xmax:float -> unit

Updating and accessing histogram elements

val accumulate : t -> ?w:float -> float -> unit
val get : t -> int -> float
val get_range : t -> int -> float * float
val h_max : t -> float
val h_min : t -> float
val bins : t -> int
val reset : t -> unit

Searching histogram ranges

val find : t -> float -> int

Histograms statistics

val max_val : t -> float
val max_bin : t -> int
val min_val : t -> float
val min_bin : t -> int
val mean : t -> float
val sigma : t -> float
val sum : t -> float

Histogram operations

val equal_bins_p : t -> t -> bool
val add : t -> t -> unit
val sub : t -> t -> unit
val mul : t -> t -> unit
val div : t -> t -> unit
val scale : t -> float -> unit
val shift : t -> float -> unit

Resampling

type histo_pdf = private {
  1. pdf_n : int;
  2. pdf_range : float array;
  3. pdf_sum : float array;
}
val init : t -> histo_pdf
val sample : histo_pdf -> float -> float