protected static double computeH(final int i,double[] dist_i,double[] pij_i,double mbeta){
  double sumP=0.;
  for (int j=0; j < i; j++) {
    sumP+=(pij_i[j]=Math.exp(dist_i[j] * mbeta));
  }
  for (int j=i + 1; j < dist_i.length; j++) {
    sumP+=(pij_i[j]=Math.exp(dist_i[j] * mbeta));
  }
  if (!(sumP > 0)) {
    return Double.NEGATIVE_INFINITY;
  }
  final double s=1. / sumP;
  double sum=0.;
  for (int j=0; j < dist_i.length; j++) {
    sum+=dist_i[j] * (pij_i[j]*=s);
  }
  return Math.log(sumP) - mbeta * sum;
}

protected static double computeH ( final int i , double [ ] dist_i , double [ ] pij_i , double mbeta ) { double sumP = 0. ; for ( int j = 0 ; j < i ; j ++ ) { sumP += ( pij_i [ j ] = Math . exp ( dist_i [ j ] * mbeta ) ) ; } for ( int j = i + 1 ; j < dist_i . length ; j ++ ) { sumP += ( pij_i [ j ] = Math . exp ( dist_i [ j ] * mbeta ) ) ; } if ( ! ( sumP > 0 ) ) { return Double . NEGATIVE_INFINITY ; } final double s = 1. / sumP ; double sum = 0. ; for ( int j = 0 ; j < dist_i . length ; j ++ ) { sum += dist_i [ j ] * ( pij_i [ j ] *= s ) ; } return Math . log ( sumP ) - mbeta * sum ; }
compute h ( observed perplexity ) for row i , and the row pij_i .
