ganeti

Safe HaskellSafe-Infered

Ganeti.Utils.Statistics

Description

Utility functions for statistical accumulation.

Synopsis

Documentation

class Show c => Stat s c | c -> s whereSource

Typeclass describing necessary statistical accumulations functions. Types defining an instance of Stat behave as if the given statistics were computed on the list of values, but they allow a potentially more efficient update of a given value. c is the statistical accumulation data type itself while s is a type of spread values used to calculate a statistics. s defined as a type dependent from c in order to pretend ambiguity.

Methods

calculate :: [s] -> cSource

Calculate a statistics from the spread values list.

update :: c -> s -> s -> cSource

In a given statistics replace on value by another. This will only give meaningful results, if the original value was actually part of the statistics.

getValue :: c -> DoubleSource

Obtain the value of a statistics.

Instances

data SumStat Source

Type of statistical accumulations representing simple sum of values

Constructors

SumStat Double 

Instances

Show SumStat 
Stat Double SumStat 

data StdDevStat Source

Type of statistical accumulations representing values standard deviation

Constructors

StdDevStat Double Double Double 

Instances

Show StdDevStat 
Stat Double StdDevStat 

data MapStat Source

Type of statistical accumulations representing the amount of instances per each tags pair. See Also TagTagMap documentation.

Constructors

MapStat TagTagMap 

Instances

type TagTagMap = Map (String, String) IntSource

Type to store the number of instances for each exclusion and location pair. This is necessary to calculate second component of location score.

data MapData Source

Data type used to store spread values of type TagTagMap. This data type is introduced only to defin an instance of Stat for TagTagMap.

Constructors

MapData TagTagMap 

Instances

toDouble :: Integral a => a -> DoubleSource

Converts Integral types to Double. It's usefull than it's not enough type information in the expression to call fromIntegral directly.