summaryrefslogtreecommitdiff
path: root/src/python
diff options
context:
space:
mode:
authorMathieuCarriere <mathieu.carriere3@gmail.com>2020-01-26 02:54:35 -0500
committerMathieuCarriere <mathieu.carriere3@gmail.com>2020-01-26 02:54:35 -0500
commit4c0e6e4144dd3cf6da9600fd4b9bbcac5e664b73 (patch)
treee236a9e35e8655e5dd49cd46064803f14ed589dc /src/python
parent85ceea9512634a62664208cd2d0f1ce48bafa171 (diff)
added extended persistence function
Diffstat (limited to 'src/python')
-rw-r--r--src/python/gudhi/simplex_tree.pxd2
-rw-r--r--src/python/gudhi/simplex_tree.pyx14
2 files changed, 16 insertions, 0 deletions
diff --git a/src/python/gudhi/simplex_tree.pxd b/src/python/gudhi/simplex_tree.pxd
index 1066d44b..39f2a45f 100644
--- a/src/python/gudhi/simplex_tree.pxd
+++ b/src/python/gudhi/simplex_tree.pxd
@@ -43,6 +43,8 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
void remove_maximal_simplex(vector[int] simplex)
bool prune_above_filtration(double filtration)
bool make_filtration_non_decreasing()
+ void extend_filtration()
+ vector[vector[pair[int, pair[double, double]]]] convert(vector[pair[int, pair[double, double]]])
cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi":
cdef cppclass Simplex_tree_persistence_interface "Gudhi::Persistent_cohomology_interface<Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_full_featured>>":
diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index b18627c4..cfab14f4 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -386,6 +386,20 @@ cdef class SimplexTree:
"""
return self.get_ptr().make_filtration_non_decreasing()
+ def extend_filtration(self):
+ """ This function extends filtration for computing extended persistence.
+ """
+ return self.get_ptr().extend_filtration()
+
+ def convert(self, dgm):
+ """This function retrieves good values for extended persistence, and separate the diagrams into the ordinary, relative, extended+ and extended- subdiagrams. Need extend_filtration to be called first!
+
+ :param dgm: Persistence diagram obtained after calling this->extend_filtration and this->get_persistence.
+ :returns: A vector of four persistence diagrams. The first one is Ordinary, the second one is Relative, the third one is Extended+ and the fourth one is Extended-.
+ """
+ return self.get_ptr().convert(dgm)
+
+
def persistence(self, homology_coeff_field=11, min_persistence=0, persistence_dim_max = False):
"""This function returns the persistence of the simplicial complex.