module ArrayFastMethods

Constants

VERSION

Public Instance Methods

mean() click to toggle source
# File lib/array_fast_methods.rb, line 4
def mean
  (sum.to_f / size.to_f)
end
std_dev() click to toggle source
# File lib/array_fast_methods.rb, line 15
def std_dev
  Math.sqrt(variance)
end
variance() click to toggle source
# File lib/array_fast_methods.rb, line 8
def variance
  m = mean
  sum_let = 0.0
  each {|v| sum_let += (v-m)**2 }
  sum_let/size
end