diff options
author | JamesP <jlp765@gmail.com> | 2015-11-11 08:56:12 +1000 |
---|---|---|
committer | JamesP <jlp765@gmail.com> | 2015-11-11 08:56:12 +1000 |
commit | 0cf4e2603f7dee5f29148deaa134f6560b68353b (patch) | |
tree | 3289e473ba0be842322490f211825d6260b6230d /lib | |
parent | 7d62b9fc1a7f8ec18c83b3800aaaecda1b085c46 (diff) | |
download | Nim-0cf4e2603f7dee5f29148deaa134f6560b68353b.tar.gz |
Removal of stats procs for openarray (use the RunningStat methodology)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/math.nim | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim index 91877fcfa..b0104336e 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -118,26 +118,6 @@ proc sum*[T](x: openArray[T]): T {.noSideEffect.} = ## If `x` is empty, 0 is returned. for i in items(x): result = result + i -template toFloat(f: float): float = f - -proc mean*[T](x: openArray[T]): float {.noSideEffect.} = - ## Computes the mean of the elements in `x`, which are first converted to floats. - ## If `x` is empty, NaN is returned. - ## ``toFloat(x: T): float`` must be defined. - for i in items(x): result = result + toFloat(i) - result = result / toFloat(len(x)) - -proc variance*[T](x: openArray[T]): float {.noSideEffect.} = - ## Computes the variance of the elements in `x`. - ## If `x` is empty, NaN is returned. - ## ``toFloat(x: T): float`` must be defined. - result = 0.0 - var m = mean(x) - for i in items(x): - var diff = toFloat(i) - m - result = result + diff*diff - result = result / toFloat(len(x)) - proc random*(max: int): int {.benign.} ## Returns a random number in the range 0..max-1. The sequence of ## random number is always the same, unless `randomize` is called |