summaryrefslogtreecommitdiff
path: root/ot
diff options
context:
space:
mode:
authorLeoGautheron <leo_g_autheron@hotmail.fr>2018-07-16 06:56:34 +0200
committerLeoGautheron <leo_g_autheron@hotmail.fr>2018-07-16 06:56:34 +0200
commit0764e356325df7e18f72c0ff468bfa8f8ee35059 (patch)
tree1880c3c7c8fc0f044c7c68ef08a3d5a5e4352493 /ot
parent73e61546b5509648ba6b7924d6e5a3ebe7fade5b (diff)
Add comment & fix flake8 error
Diffstat (limited to 'ot')
-rw-r--r--ot/bregman.py1
-rw-r--r--ot/utils.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/ot/bregman.py b/ot/bregman.py
index 55c44f6..c8e69ce 100644
--- a/ot/bregman.py
+++ b/ot/bregman.py
@@ -344,6 +344,7 @@ def sinkhorn_knopp(a, b, M, reg, numItermax=1000,
# print(reg)
+ # Next 3 lines equivalent to K= np.exp(-M/reg), but faster to compute
K = np.empty(M.shape, dtype=M.dtype)
np.divide(M, -reg, out=K)
np.exp(K, out=K)
diff --git a/ot/utils.py b/ot/utils.py
index 14cc805..bb21b38 100644
--- a/ot/utils.py
+++ b/ot/utils.py
@@ -76,6 +76,7 @@ def clean_zeros(a, b, M):
b2 = b[b > 0]
return a2, b2, M2
+
def euclidean_distances(X, Y, squared=False):
"""
Considering the rows of X (and Y=X) as vectors, compute the