public static double Taneja ( double [ ] p , double [ ] q ) { double r = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { if ( p [ i ] != 0 && q [ i ] != 0 ) { double pq = p [ i ] + q [ i ] ; r += ( pq / 2 ) * Math . log ( pq / ( 2 * Math . sqrt ( p [ i ] * q [ i ] ) ) ) ; } } return r ; }
Gets the Taneja divergence .