summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorJamesP <jlp765@gmail.com>2015-11-07 15:10:51 +1000
committerJamesP <jlp765@gmail.com>2015-11-07 15:10:51 +1000
commit03590a1c42905d7786f307ec8e3ba6930059ee83 (patch)
tree5a3a1d5ac97715e8ed5a0a934a34af29b0fbf100 /lib
parentae60f4ae760223c57403f2ac59014374b4655377 (diff)
downloadNim-03590a1c42905d7786f307ec8e3ba6930059ee83.tar.gz
Removal of RunningStats ready for new stats.nim pure lib file
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/math.nim42
1 files changed, 0 insertions, 42 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim
index 391a880ae..91877fcfa 100644
--- a/lib/pure/math.nim
+++ b/lib/pure/math.nim
@@ -376,48 +376,6 @@ proc random*[T](a: openArray[T]): T =
   ## returns a random element from the openarray `a`.
   result = a[random(a.low..a.len)]
 
-type
-  RunningStat* = object                 ## an accumulator for statistical data
-    n*: int                             ## number of pushed data
-    sum*, min*, max*, mean*: float      ## self-explaining
-    oldM, oldS, newS: float
-
-{.deprecated: [TFloatClass: FloatClass, TRunningStat: RunningStat].}
-
-proc push*(s: var RunningStat, x: float) =
-  ## pushes a value `x` for processing
-  inc(s.n)
-  # See Knuth TAOCP vol 2, 3rd edition, page 232
-  if s.n == 1:
-    s.min = x
-    s.max = x
-    s.oldM = x
-    s.mean = x
-    s.oldS = 0.0
-  else:
-    if s.min > x: s.min = x
-    if s.max < x: s.max = x
-    s.mean = s.oldM + (x - s.oldM)/toFloat(s.n)
-    s.newS = s.oldS + (x - s.oldM)*(x - s.mean)
-
-    # set up for next iteration:
-    s.oldM = s.mean
-    s.oldS = s.newS
-  s.sum = s.sum + x
-
-proc push*(s: var RunningStat, x: int) =
-  ## pushes a value `x` for processing. `x` is simply converted to ``float``
-  ## and the other push operation is called.
-  push(s, toFloat(x))
-
-proc variance*(s: RunningStat): float =
-  ## computes the current variance of `s`
-  if s.n > 1: result = s.newS / (toFloat(s.n - 1))
-
-proc standardDeviation*(s: RunningStat): float =
-  ## computes the current standard deviation of `s`
-  result = sqrt(variance(s))
-
 {.pop.}
 {.pop.}