diff options
author | ievred <ievgen.redko@univ-st-etienne.fr> | 2020-04-03 16:06:39 +0200 |
---|---|---|
committer | ievred <ievgen.redko@univ-st-etienne.fr> | 2020-04-03 16:06:39 +0200 |
commit | fa99199c02e497354e34c6ce76e7b4ba15b44d05 (patch) | |
tree | b1496091391f74556a848b48e07fe54243af4491 /ot/utils.py | |
parent | 90f5d5f60af9ef25d7aba715e2398946e5ee16da (diff) |
v2 laplace emd sinkhorn
Diffstat (limited to 'ot/utils.py')
-rw-r--r-- | ot/utils.py | 5 |
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) |