public static double SymmetricKullbackLeibler ( double [ ] p , double [ ] q ) { double dist = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { dist += ( p [ i ] - q [ i ] ) * ( Math . log ( p [ i ] ) - Math . log ( q [ i ] ) ) ; } return dist ; }
Gets the Symmetric Kullback - Leibler distance . This metric is valid only for real and positive P and Q .