view 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 source
/** 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);
    }
}

http://dive4elements.wald.intevation.org