summaryrefslogtreecommitdiff
path: root/geom_matching/wasserstein/src/basic_defs.cpp
diff options
context:
space:
mode:
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)
{