summaryrefslogtreecommitdiff
path: root/src/python/gudhi/wasserstein
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-04-20 18:41:59 +0200
committerMarc Glisse <marc.glisse@inria.fr>2020-04-20 18:41:59 +0200
commit0393fdd3da2b5e403757c0f3418919c81ccbdd76 (patch)
tree008b752c6069b165efee50cb928adc8267343101 /src/python/gudhi/wasserstein
parent1086b8cad7c1ea2a02742dfc44aef036a674f5d3 (diff)
parent93cd1240ef65d8883ec624e6e393c09969bf4d6f (diff)
Merge remote-tracking branch 'origin/master' into wass-autodiff
Diffstat (limited to 'src/python/gudhi/wasserstein')
-rw-r--r--src/python/gudhi/wasserstein/wasserstein.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/python/gudhi/wasserstein/wasserstein.py b/src/python/gudhi/wasserstein/wasserstein.py
index f0c82962..5b61d176 100644
--- a/src/python/gudhi/wasserstein/wasserstein.py
+++ b/src/python/gudhi/wasserstein/wasserstein.py
@@ -15,6 +15,17 @@ try:
except ImportError:
print("POT (Python Optimal Transport) package is not installed. Try to run $ conda install -c conda-forge pot ; or $ pip install POT")
+
+# Currently unused, but Théo says it is likely to be used again.
+def _proj_on_diag(X):
+ '''
+ :param X: (n x 2) array encoding the points of a persistent diagram.
+ :returns: (n x 2) array encoding the (respective orthogonal) projections of the points onto the diagonal
+ '''
+ Z = (X[:,0] + X[:,1]) / 2.
+ return np.array([Z , Z]).T
+
+
def _dist_to_diag(X, internal_p):
'''
:param X: (n x 2) array encoding the points of a persistent diagram.