private List < DoubleIntInt > computeZijs ( double [ ] [ ] averageDistances , final int dim ) { List < DoubleIntInt > z_ijs = new ArrayList <> ( averageDistances . length * dim ) ; for ( int i = 0 ; i < averageDistances . length ; i ++ ) { double [ ] x_i = averageDistances [ i ] ; // y_i double y_i = 0 ; for ( int j = 0 ; j < dim ; j ++ ) { y_i += x_i [ j ] ; } y_i /= dim ; // sigma_i double sigma_i = 0 ; for ( int j = 0 ; j < dim ; j ++ ) { double diff = x_i [ j ] - y_i ; sigma_i += diff * diff ; } sigma_i /= ( dim - 1 ) ; sigma_i = FastMath . sqrt ( sigma_i ) ; for ( int j = 0 ; j < dim ; j ++ ) { z_ijs . add ( new DoubleIntInt ( ( x_i [ j ] - y_i ) / sigma_i , i , j ) ) ; } } Collections . sort ( z_ijs ) ; return z_ijs ; }
Compute the z_ij values .