com.github.chen0040.glm.maths.Mean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-glm Show documentation
Show all versions of java-glm Show documentation
Generalized linear models implemented in Java
package com.github.chen0040.glm.maths;
/**
* Created by xschen on 14/8/15.
*/
public class Mean {
public static double apply(double[] values){
int length = values.length;
if(length==0) return Double.NaN;
double sum = 0;
for(int i=0; i < length; ++i){
sum += values[i];
}
return sum / length;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy