Example usage for org.apache.commons.math.util ResizableDoubleArray getElements

List of usage examples for org.apache.commons.math.util ResizableDoubleArray getElements

Introduction

In this page you can find the example usage for org.apache.commons.math.util ResizableDoubleArray getElements.

Prototype

public synchronized double[] getElements() 

Source Link

Document

Returns a double array containing the elements of this ResizableArray.

Usage

From source file:edu.harvard.med.screensaver.analysis.ZScoreFunction.java

public void initializeAggregates(Collection<Double> valuesToNormalizeOverController) {
    ResizableDoubleArray tmpDoubleValues = new ResizableDoubleArray();
    for (Double value : valuesToNormalizeOverController) {
        tmpDoubleValues.addElement(value);
    }//from   ww  w .j  av a  2 s . c om
    _stdDev = new StandardDeviation().evaluate(tmpDoubleValues.getElements());
    _mean = new Mean().evaluate(tmpDoubleValues.getElements());
    _initialized = true;
}

From source file:edu.harvard.med.screensaver.analysis.heatmaps.HeatMap.java

private void initialize(Filter<Pair<WellKey, ResultValue>> scoringFilter,
        AggregateFunction<Double> scoringFunc) {

    Collection<Double> aggregationValues = new ArrayList<Double>();
    for (WellKey wellKey : _resultValues.keySet()) {
        if (wellKey.getPlateNumber() == _plateNumber) {
            ResultValue rv = getResultValue(wellKey.getRow(), wellKey.getColumn());
            if (rv != null && !scoringFilter.exclude(new Pair<WellKey, ResultValue>(wellKey, rv))) {
                aggregationValues.add(getRawValue(wellKey.getRow(), wellKey.getColumn()));
            }//w w  w  . j a v  a 2  s.com
        }
    }

    scoringFunc.initializeAggregates(aggregationValues);

    _statistics = new DescriptiveStatisticsImpl();
    ResizableDoubleArray medianValues = new ResizableDoubleArray();
    for (Double rawValue : aggregationValues) {
        double scoredValue = scoringFunc.compute(rawValue);
        _statistics.addValue(scoredValue);
        medianValues.addElement(scoredValue);
    }

    _median = new Median().evaluate(medianValues.getElements());

    _scalableColorFunction.setLowerLimit(_statistics.getMin());
    _scalableColorFunction.setUpperLimit(_statistics.getMax());
}