summaryrefslogtreecommitdiff
path: root/ot/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ot/utils.py')
-rw-r--r--ot/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ot/utils.py b/ot/utils.py
index b71458b..b8a6f44 100644
--- a/ot/utils.py
+++ b/ot/utils.py
@@ -48,6 +48,11 @@ def kernel(x1, x2, method='gaussian', sigma=1, **kwargs):
K = np.exp(-dist(x1, x2) / (2 * sigma**2))
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)