question: protected static void computeSigma ( int i , DoubleArray pij_row , double perplexity , double log_perp , double [ ] pij_i ) { double max = pij_row . get ( ( int ) Math . ceil ( perplexity ) ) / Math . E ; double beta = 1 / max ; double diff = computeH ( pij_row , pij_i , - beta ) - log_perp ; double betaMin = 0. ; double betaMax = Double . POSITIVE_INFINITY ; for ( int tries = 0 ; tries < PERPLEXITY_MAXITER && Math . abs ( diff ) > PERPLEXITY_ERROR ; ++ tries ) { if ( diff > 0 ) { betaMin = beta ; beta += ( betaMax == Double . POSITIVE_INFINITY ) ? beta : ( ( betaMax - beta ) * .5 ) ; } else { betaMax = beta ; beta -= ( beta - betaMin ) * .5 ; } diff = computeH ( pij_row , pij_i , - beta ) - log_perp ; } }
target:  Compute row pij[i], using binary search on the kernel bandwidth sigma to obtain the desired perplexity.