public static double SymmetricChiSquareDivergence ( double [ ] p , double [ ] q ) { double r = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { double den = p [ i ] * q [ i ] ; if ( den != 0 ) { double p1 = p [ i ] - q [ i ] ; double p2 = p [ i ] + q [ i ] ; r += ( p1 * p1 * p2 ) / den ; } } return r ; }
Gets the Symmetric Chi - square divergence .