# HG changeset patch # User Felix Wolfsteller # Date 1375865333 -7200 # Node ID 34c15927f9d9782846061778063204662e1bb386 # Parent 9479cb7c8cd5651d6979dfb85fe98ff0653f87af cosmetics. diff -r 9479cb7c8cd5 -r 34c15927f9d9 artifacts/src/main/java/org/dive4elements/river/artifacts/math/MovingAverage.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/math/MovingAverage.java Tue Aug 06 17:00:49 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/math/MovingAverage.java Wed Aug 07 10:48:53 2013 +0200 @@ -37,7 +37,11 @@ return new double [][] { xs, ys }; } - public static double[][] weighted(double[][] values, double radius) { + /** Build moving average over values. Weight them. */ + public static double[][] weighted( + double[][] values, + double radius + ) { TreeMap map = toMap(values); int N = map.size(); double [] xs = new double[N]; @@ -62,6 +66,7 @@ return new double [][] { xs, ys }; } + /** From [x1,x2][y1,y2] makes {x1:y1,x2:y2}. Sorted by x! */ private static TreeMap toMap(double[][] values) { TreeMap map = new TreeMap(); double [] xs = values[0];