summaryrefslogtreecommitdiff
path: root/ot/lp/emd_wrap.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'ot/lp/emd_wrap.pyx')
-rw-r--r--ot/lp/emd_wrap.pyx3
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]