quspin.tools.misc.KL_div
- quspin.tools.misc.KL_div(p1, p2)[source]
Calculates Kullback-Leibler divergence of two discrete probability distributions.
\[\mathrm{KL}(p_1||p_2) = \sum_n p_1(n)\log\frac{p_1(n)}{p_2(n)}\]- Parameters:
- p1numpy.ndarray
Dscrete probability distribution.
- p2numpy.ndarray
Discrete probability distribution.
- Returns:
- numpy.ndarray
Kullback-Leibler divergence of p1 and p2.