diff options
author | Romain Tavenard <romain.tavenard@univ-rennes2.fr> | 2019-06-27 10:23:32 +0200 |
---|---|---|
committer | Romain Tavenard <romain.tavenard@univ-rennes2.fr> | 2019-06-27 10:23:32 +0200 |
commit | 0d333e004636f5d25edea6bb195e8e4d9a95ba98 (patch) | |
tree | 75b40d64101c0f503e6ed8d3101db1c095ffbd72 /ot/lp/emd_wrap.pyx | |
parent | 1140141938c678d267f688dbb9106d3422d633c5 (diff) |
Improved tests and docs for wasserstein_1d
Diffstat (limited to 'ot/lp/emd_wrap.pyx')
-rw-r--r-- | ot/lp/emd_wrap.pyx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ot/lp/emd_wrap.pyx b/ot/lp/emd_wrap.pyx index 7134136..42b848f 100644 --- a/ot/lp/emd_wrap.pyx +++ b/ot/lp/emd_wrap.pyx @@ -13,6 +13,7 @@ cimport numpy as np from ..utils import dist cimport cython +cimport libc.math as math import warnings @@ -159,7 +160,7 @@ def emd_1d_sorted(np.ndarray[double, ndim=1, mode="c"] u_weights, elif metric == 'cityblock' or metric == 'euclidean': m_ij = abs(u[i] - v[j]) elif metric == 'minkowski': - m_ij = abs(u[i] - v[j]) ** p + m_ij = math.pow(abs(u[i] - v[j]), p) else: m_ij = dist(u[i].reshape((1, 1)), v[j].reshape((1, 1)), metric=metric)[0, 0] |