Revision e27eb8ab Ganeti/HTools/Utils.hs

b/Ganeti/HTools/Utils.hs
81 81
-- Simple and slow statistical functions, please replace with better versions
82 82

  
83 83
-- | Mean value of a list.
84
meanValue :: Floating a => [a] -> a
84
meanValue :: [Double] -> Double
85 85
meanValue lst = sum lst / fromIntegral (length lst)
86 86

  
87 87
-- | Standard deviation.
88
stdDev :: Floating a => [a] -> a
88
stdDev :: [Double] -> Double
89 89
stdDev lst =
90 90
    let mv = meanValue lst
91 91
        av = foldl' (\accu em -> let d = em - mv in accu + d * d) 0.0 lst
......
93 93
    in bv
94 94

  
95 95
-- | Coefficient of variation.
96
varianceCoeff :: Floating a => [a] -> a
96
varianceCoeff :: [Double] -> Double
97 97
varianceCoeff lst = stdDev lst / fromIntegral (length lst)
98 98

  
99 99
-- * JSON-related functions

Also available in: Unified diff