Example usage for org.apache.commons.math.stat.descriptive.moment Mean incrementAll

List of usage examples for org.apache.commons.math.stat.descriptive.moment Mean incrementAll

Introduction

In this page you can find the example usage for org.apache.commons.math.stat.descriptive.moment Mean incrementAll.

Prototype

public void incrementAll(double[] values) 

Source Link

Document

This default implementation just calls #increment in a loop over the input array.

Usage

From source file:com.joliciel.jochre.graphics.ShapeImpl.java

double getBrightnessMeanBySector(String key, SectionBrightnessMeasurementMethod measurementMethod) {
    Map<SectionBrightnessMeasurementMethod, Double> methodToMeanMap = this.brightnessMeanBySectorMap.get(key);
    if (methodToMeanMap == null) {
        methodToMeanMap = new HashMap<Shape.SectionBrightnessMeasurementMethod, Double>();
        this.brightnessMeanBySectorMap.put(key, methodToMeanMap);
    }//from   w  w  w .  j  a v  a 2  s .  c  o  m
    Double brightnessMeanBySectorObj = methodToMeanMap.get(measurementMethod);
    double brightnessMeanBySector = 0.0;
    if (brightnessMeanBySectorObj == null) {
        Mean mean = new Mean();
        Map<SectionBrightnessMeasurementMethod, double[][]> brightnessByMethod = this.brightnessBySectorMap
                .get(key);
        double[][] brightnessGrid = brightnessByMethod.get(measurementMethod);
        for (int i = 0; i < brightnessGrid.length; i++)
            mean.incrementAll(brightnessGrid[i]);
        brightnessMeanBySector = mean.getResult();
        methodToMeanMap.put(measurementMethod, brightnessMeanBySector);
    } else {
        brightnessMeanBySector = brightnessMeanBySectorObj.doubleValue();
    }
    return brightnessMeanBySector;
}