def __kullback_leibler(h1, h2): # 36.3 us
    """
    The actual KL implementation. @see kullback_leibler() for details.
    Expects the histograms to be of type scipy.ndarray.
    """
    result = h1.astype(scipy.float_)
    mask = h1 != 0
    result[mask] = scipy.multiply(h1[mask], scipy.log(h1[mask] / h2[mask]))
    return scipy.sum(result)
def __kullback_leibler ( h1 , h2 ) : result = h1 . astype ( scipy . float_ ) mask = h1 != 0 result [ mask ] = scipy . multiply ( h1 [ mask ] , scipy . log ( h1 [ mask ] / h2 [ mask ] ) ) return scipy . sum ( result )
The actual KL implementation. @see kullback_leibler() for details.
    Expects the histograms to be of type scipy.ndarray.