g@9646: /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde g@9646: * Software engineering by g@9646: * Björnsen Beratende Ingenieure GmbH g@9646: * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt g@9646: * g@9646: * This file is Free Software under the GNU AGPL (>=v3) g@9646: * and comes with ABSOLUTELY NO WARRANTY! Check out the g@9646: * documentation coming with Dive4Elements River for details. g@9646: */ g@9646: package org.dive4elements.river.artifacts.model.fixings.fitting; g@9646: g@9646: import org.apache.commons.math3.stat.StatUtils; g@9646: g@9646: /** g@9646: * @author Gernot Belger g@9646: */ g@9646: final class SQRTFunction { g@9646: private final ArraySubstraction substraction; g@9646: g@9646: public SQRTFunction(final double[] observations) { g@9646: this.substraction = new ArraySubstraction(observations); g@9646: } g@9646: g@9646: public double calc_sqrt(final double[] values) { g@9646: g@9646: final double[] difference = this.substraction.evaluate(values); g@9646: g@9646: return StatUtils.sumSq(difference); g@9646: } g@9646: }