# Module histogram_rt

- Description
- Data Types
- Function Index
- Function Details

Like histogram.erl but takes ?RT:key() as value and operates in the key space according to the used routing table.

Copyright © 2013-2014 Zuse Institute Berlin

Version: $Id$

Authors: Maximilian Michels (`michels@zib.de`).

## Description

Like histogram.erl but takes ?RT:key() as value and operates in the key space according to the used routing table. The histogram's interval span is ['(', BaseKey, BaseKey, ']'].

## Data Types

### base_key()

    base_key() = key()

### external_data_item()

    external_data_item() = {key(), pos_integer()}

### external_data_list()

    external_data_list() = [external_data_item()]

### histogram()

abstract datatype: `histogram()`

### key()

    key() = rt_chord:key()

## Function Index

add/2 |
add/3 |
create/2 |
foldl_until/2 | Traverses the histogram until TargetCount entries have been found and returns the value at this position.
foldr_until/2 | Like foldl_until but traverses the list from the right.
get_data/1 |
get_num_elements/1 |
get_num_inserts/1 |
get_size/1 |
is_histogram/1 |
merge/2 | Merges the given two histograms by adding every data point of Hist2 to Hist1.
merge_weighted/3 | Merges Hist2 into Hist1 and applies a weight to the Count of Hist2.
normalize_count/2 | Normalizes the Count by a normalization constant N.
tester_create_histogram/2 |

## Function Details

### create/2

    create(Size :: non_neg_integer(), BaseKey :: base_key()) ->
              histogram()

### add/2

    add(Value :: key(), Histogram :: histogram()) -> histogram()

### add/3

    add(Value :: key(),
        Count :: pos_integer(),
        Histogram :: histogram()) ->
           histogram()

### get_data/1

    get_data(Histogram :: histogram()) -> external_data_list()

### get_size/1

    get_size(Histogram :: histogram()) -> non_neg_integer()

### get_num_elements/1

    get_num_elements(Histogram :: histogram()) -> non_neg_integer()

### get_num_inserts/1

    get_num_inserts(Histogram :: histogram()) -> non_neg_integer()

### merge/2

    merge(Hist1 :: histogram(), Hist2 :: histogram()) -> histogram()

Merges the given two histograms by adding every data point of Hist2 to Hist1

### merge_weighted/3

    merge_weighted(Hist1 :: histogram(),
                   Hist2 :: histogram(),
                   Weight :: pos_integer()) ->
                      histogram()

Merges Hist2 into Hist1 and applies a weight to the Count of Hist2

### normalize_count/2

    normalize_count(N :: pos_integer(), Histogram :: histogram()) ->
                       histogram()

Normalizes the Count by a normalization constant N

### foldl_until/2

    foldl_until(TargetCount :: non_neg_integer(), X2 :: histogram()) ->
                   {fail,
                    Value :: key() | nil,
                    SumSoFar :: non_neg_integer()} |
                   {ok,
                    Value :: key() | nil,
                    Sum :: non_neg_integer()}

Traverses the histogram until TargetCount entries have been found and returns the value at this position.

### foldr_until/2

    foldr_until(TargetCount :: non_neg_integer(), X2 :: histogram()) ->
                   {fail,
                    Value :: key() | nil,
                    SumSoFar :: non_neg_integer()} |
                   {ok,
                    Value :: key() | nil,
                    Sum :: non_neg_integer()}

Like foldl_until but traverses the list from the right

### is_histogram/1

    is_histogram(X1 :: histogram() | any()) -> boolean()

### tester_create_histogram/2

    tester_create_histogram(Entries :: [{key(), pos_integer()}],
                            BaseKey :: base_key()) ->
                               histogram()

Generated by EDoc, Feb 29 2016, 16:12:18.