Mercurial > dive4elements > river
changeset 6763:34c15927f9d9
cosmetics.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 07 Aug 2013 10:48:53 +0200 |
parents | 9479cb7c8cd5 |
children | 5ae10d4688ab |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/math/MovingAverage.java |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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<Double, Double> 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<Double, Double> toMap(double[][] values) { TreeMap<Double, Double> map = new TreeMap<Double, Double>(); double [] xs = values[0];