diff options
Diffstat (limited to 'src/cython')
-rw-r--r-- | src/cython/cython/cubical_complex.pyx | 22 | ||||
-rw-r--r-- | src/cython/cython/periodic_cubical_complex.pyx | 22 |
2 files changed, 42 insertions, 2 deletions
diff --git a/src/cython/cython/cubical_complex.pyx b/src/cython/cython/cubical_complex.pyx index 321fc22a..d65d2060 100644 --- a/src/cython/cython/cubical_complex.pyx +++ b/src/cython/cython/cubical_complex.pyx @@ -44,7 +44,7 @@ cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi": vector[pair[int, pair[double, double]]] get_persistence(int homology_coeff_field, double min_persistence) vector[int] betti_numbers() vector[int] persistent_betti_numbers(double from_value, double to_value) - + vector[pair[double,double]] intervals_in_dimension(int dimension) # CubicalComplex python interface cdef class CubicalComplex: @@ -175,3 +175,23 @@ cdef class CubicalComplex: if self.pcohptr != NULL: pbn_result = self.pcohptr.persistent_betti_numbers(<double>from_value, <double>to_value) return pbn_result + + def intervals_in_dim(self, dimension): + """This function returns the persistence intervals of the simplicial + complex in a specific dimension. + + :param dimension: The specific dimension. + :type from_value: int. + :returns: The persistence intervals. + :rtype: list of pair of float + + :note: betti_numbers function requires persistence function to be + launched first. + """ + cdef vector[pair[double,double]] intervals_result + if self.pcohptr != NULL: + intervals_result = self.pcohptr.intervals_in_dimension(dimension) + else: + print("intervals_in_dim function requires persistence function" + " to be launched first.") + return intervals_result diff --git a/src/cython/cython/periodic_cubical_complex.pyx b/src/cython/cython/periodic_cubical_complex.pyx index c1b25f31..9175ac47 100644 --- a/src/cython/cython/periodic_cubical_complex.pyx +++ b/src/cython/cython/periodic_cubical_complex.pyx @@ -44,7 +44,7 @@ cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi": vector[pair[int, pair[double, double]]] get_persistence(int homology_coeff_field, double min_persistence) vector[int] betti_numbers() vector[int] persistent_betti_numbers(double from_value, double to_value) - + vector[pair[double,double]] intervals_in_dimension(int dimension) # PeriodicCubicalComplex python interface cdef class PeriodicCubicalComplex: @@ -175,3 +175,23 @@ cdef class PeriodicCubicalComplex: if self.pcohptr != NULL: pbn_result = self.pcohptr.persistent_betti_numbers(<double>from_value, <double>to_value) return pbn_result + + def intervals_in_dim(self, dimension): + """This function returns the persistence intervals of the simplicial + complex in a specific dimension. + + :param dimension: The specific dimension. + :type from_value: int. + :returns: The persistence intervals. + :rtype: list of pair of float + + :note: betti_numbers function requires persistence function to be + launched first. + """ + cdef vector[pair[double,double]] intervals_result + if self.pcohptr != NULL: + intervals_result = self.pcohptr.intervals_in_dimension(dimension) + else: + print("intervals_in_dim function requires persistence function" + " to be launched first.") + return intervals_result |