[PATCH 1 of 8] cosmetics
Wald Commits
scm-commit at wald.intevation.org
Wed Aug 7 10:55:26 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# 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<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];
More information about the Dive4elements-commits
mailing list