summaryrefslogtreecommitdiff
path: root/geom_matching/wasserstein/src/basic_defs.cpp
diff options
context:
space:
mode:
authorArnur Nigmetov <a.nigmetov@gmail.com>2017-04-24 16:49:37 +0600
committerArnur Nigmetov <a.nigmetov@gmail.com>2017-04-24 16:49:37 +0600
commitbd3300343726981dbb7b7f45d1cabc9d781e28a1 (patch)
tree1ea381d8265df271fb4215f75ae8b301253d2c18 /geom_matching/wasserstein/src/basic_defs.cpp
parent0d3a01257675ee637c09046c739eaa235984b515 (diff)
Empty diagram bug for Wasserstein fixed
Diffstat (limited to 'geom_matching/wasserstein/src/basic_defs.cpp')
-rw-r--r--geom_matching/wasserstein/src/basic_defs.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/geom_matching/wasserstein/src/basic_defs.cpp b/geom_matching/wasserstein/src/basic_defs.cpp
index a46e6aa..ec5dcec 100644
--- a/geom_matching/wasserstein/src/basic_defs.cpp
+++ b/geom_matching/wasserstein/src/basic_defs.cpp
@@ -104,6 +104,20 @@ double distLp(const DiagramPoint& a, const DiagramPoint& b, const double p)
}
+double DiagramPoint::persistenceLp(const double p) const
+{
+ if (isDiagonal())
+ return 0.0;
+ else {
+ double u { 0.5 * (getRealY() + getRealX()) };
+ DiagramPoint a_proj(u, u, DiagramPoint::DIAG);
+ return distLp(*this, a_proj, p);
+ }
+
+
+}
+
+
#ifndef FOR_R_TDA
std::ostream& operator<<(std::ostream& output, const DiagramPoint p)
{