Example usage for org.apache.commons.math.stat StatUtils sumSq

List of usage examples for org.apache.commons.math.stat StatUtils sumSq

Introduction

In this page you can find the example usage for org.apache.commons.math.stat StatUtils sumSq.

Prototype

public static double sumSq(final double[] values, final int begin, final int length) 

Source Link

Document

Returns the sum of the squares of the entries in the specified portion of the input array, or Double.NaN if the designated subarray is empty.

Usage

From source file:es.udc.gii.common.eaf.benchmark.constrained_real_param.g01.G01ObjectiveFunction.java

/**
 * //from   w  w  w.  j  a  v a  2  s  .  c  o  m
 * @param values
 * f(x) = 5 * sum(xi,1,4) - 5 * sum(xi*xi,1,4) - sum(xi,5,13)
 * 0 <= xi <= 1 (i = 1,...,9)
 * 0 <= xi <= 100 (i = 10,11,12)
 * 0 <= x13 <= 1
 * @return
 */
@Override
public double evaluate(double[] values) {

    double[] norm_values;

    norm_values = G01Function.normalize(values);

    return 5.0 * StatUtils.sum(norm_values, 0, 4) - 5.0 * StatUtils.sumSq(norm_values, 0, 4)
            - StatUtils.sum(norm_values, 4, 9);

}