diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/fitting/SQRTFunction.java @ 9646:0380717105ba

Implemented alternative fitting strategy for Log-Linear function.
author Gernot Belger <g.belger@bjoernsen.de>
date Mon, 02 Dec 2019 17:56:15 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/fitting/SQRTFunction.java	Mon Dec 02 17:56:15 2019 +0100
@@ -0,0 +1,30 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.artifacts.model.fixings.fitting;
+
+import org.apache.commons.math3.stat.StatUtils;
+
+/**
+ * @author Gernot Belger
+ */
+final class SQRTFunction {
+    private final ArraySubstraction substraction;
+
+    public SQRTFunction(final double[] observations) {
+        this.substraction = new ArraySubstraction(observations);
+    }
+
+    public double calc_sqrt(final double[] values) {
+
+        final double[] difference = this.substraction.evaluate(values);
+
+        return StatUtils.sumSq(difference);
+    }
+}
\ No newline at end of file

http://dive4elements.wald.intevation.org