aboutsummaryrefslogtreecommitdiff
path: root/src/nbc/kahan.sml
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-05-28 10:47:11 -0400
committerCalvin <calvin@EESI>2013-05-28 10:47:11 -0400
commitdd38d0d1dda2be42bf280aeca110542f2f2fef1b (patch)
treec921dc0690e29f1b7b913aaa72b9c12539faa5a1 /src/nbc/kahan.sml
parent2f33e34ae06b96c3f3e4456ce960172903f60bfb (diff)
removed files
Diffstat (limited to 'src/nbc/kahan.sml')
-rw-r--r--src/nbc/kahan.sml31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/nbc/kahan.sml b/src/nbc/kahan.sml
deleted file mode 100644
index 70c6b47..0000000
--- a/src/nbc/kahan.sml
+++ /dev/null
@@ -1,31 +0,0 @@
-(* Kahan summation *)
-
-signature KAHAN = sig
- type t
- val zero: t
- val add: t * real -> t
- val sum: t -> real
- val sequence: real Sequence.t -> real
- val list: real list -> real
- val array: real array -> real
-end
-
-structure Kahan :> KAHAN = struct
- type t = real * real
- val zero = (0.0, 0.0)
- fun add ((s, c), x) =
- let
- val y = x - c
- val t = s + y
- in
- (t, t - s - y)
- end
- fun sum (s, c) = s
- local
- fun swappedAdd (a, b) = add (b, a)
- in
- fun sequence e = sum (Sequence.fold swappedAdd zero e)
- fun list l = sum (foldl swappedAdd zero l)
- fun array a = sum (Array.foldl swappedAdd zero a)
- end
-end