public static double[] normalizeZscore(double[] x){
  double mn=mean(x,0);
  double sd=standardDeviation(x,0);
  for (int i=0; i < x.length; i++)   if (!Double.isNaN(x[i]))   x[i]=(x[i] - mn) / sd;
  return x;
}

public static double [ ] normalizeZscore ( double [ ] x ) { double mn = mean ( x , 0 ) ; double sd = standardDeviation ( x , 0 ) ; for ( int i = 0 ; i < x . length ; i ++ ) if ( ! Double . isNaN ( x [ i ] ) ) x [ i ] = ( x [ i ] - mn ) / sd ; return x ; }
calcualtes x_i = ( x_i - mean ( x ) ) / std ( x ) this function can deal with nans
