summaryrefslogtreecommitdiff
path: root/ot/utils.py
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2020-04-20 22:04:03 +0200
committerRémi Flamary <remi.flamary@gmail.com>2020-04-20 22:04:03 +0200
commit21949bbc3469234f88972bdfe973f68eb9e62794 (patch)
tree6bc93db587bd80d0ccb9e33596c4526aeaefec4c /ot/utils.py
parentd54184c233cd211a693e4cdf4b25dd68b07ed00b (diff)
parent43b2190db71b1ccbeec8fddaae23ca6af220e1b5 (diff)
Merge branch 'master' into doc_travis
Diffstat (limited to 'ot/utils.py')
-rw-r--r--ot/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ot/utils.py b/ot/utils.py
index c154f99..f9911a1 100644
--- a/ot/utils.py
+++ b/ot/utils.py
@@ -49,6 +49,12 @@ def kernel(x1, x2, method='gaussian', sigma=1, **kwargs):
return K
+def laplacian(x):
+ """Compute Laplacian matrix"""
+ L = np.diag(np.sum(x, axis=0)) - x
+ return L
+
+
def unif(n):
""" return a uniform histogram of length n (simplex)