public static double harmonicMean ( FlatDataCollection flatDataCollection ) { int n = 0 ; double harmonicMean = 0.0 ; Iterator < Double > it = flatDataCollection . iteratorDouble ( ) ; while ( it . hasNext ( ) ) { Double v = it . next ( ) ; if ( v != null ) { ++ n ; harmonicMean += 1.0 / v ; } } harmonicMean = n / harmonicMean ; return harmonicMean ; }
Calculates Harmonic Mean