/**
 * Copyright (C) 2010 openecho
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/
package kinetic.math.statistic;

import java.lang.reflect.Array;

/**
 * Standard Deviation Utility
 *
 * @author openecho
 * @version 1.0.1
 */
public class StandardDeviation {
    public static Double evaluate(Double[] data) {
        if(data==null) {
            throw new NullPointerException();
        }
        int length = Array.getLength(data);
        if(length < 2) {
            throw new RuntimeException("More than two values are required to calculate a standard deviation");
        }
        double mean = Mean.evaluate(data);
        double sumDifferenceSquared = 0;
        for(int i=0;i<length;i++) {
            sumDifferenceSquared += Math.pow(data[i]-mean,2);
        }
        return Math.sqrt(sumDifferenceSquared/(length-1));
    }
}

@@ -770,16 +770,17 @@
 ation %7B%0A
+%0A
     publ
@@ -818,24 +818,164 @@
 e%5B%5D data) %7B%0A
+        return StandardDeviation.evaluate(data, true);%0A    %7D%0A%0A    public static Double evaluate(Double%5B%5D data, boolean partialPopulation) %7B%0A
         if(d
@@ -1476,16 +1476,51 @@
 ed/(
-length-1
+(partialPopulation) ? (length-1) : (length)
 ));%0A
@@ -1526,9 +1526,8 @@
 %0A    %7D%0A%7D
-%0A

Add population based divide option