scipy.special.rel_entr¶
- scipy.special.rel_entr(x, y) = <ufunc 'rel_entr'>¶
Elementwise function for computing relative entropy.
\[\begin{split}\text{rel\_entr}(x, y) = \begin{cases} x \log(x / y) & x > 0, y > 0 \\ 0 & x = 0, y \ge 0 \\ \infty & \text{otherwise} \end{cases}\end{split}\]Parameters: x : ndarray
First input array.
y : ndarray
Second input array.
Returns: res : ndarray
Output array.
Notes
This function is jointly convex in x and y.
New in version 0.14.0.