summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------ext/hera0
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h21
-rw-r--r--src/python/gudhi/cubical_complex.pyx4
-rw-r--r--src/python/gudhi/periodic_cubical_complex.pyx4
-rw-r--r--src/python/include/Persistent_cohomology_interface.h16
5 files changed, 29 insertions, 16 deletions
diff --git a/ext/hera b/ext/hera
-Subproject cb1838e682ec07f80720241cf9098400caeb83c
+Subproject 9a89971855acefe39dce0e2adadf53b88ca8f68
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
index 0d6299d2..7496d74a 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
@@ -110,6 +110,14 @@ class Bitmap_cubical_complex_base {
virtual inline std::vector<std::size_t> get_coboundary_of_a_cell(std::size_t cell) const;
/**
+ * This function computes the index of one of the top-dimensional cubes (chosen arbitrarily) associated
+ * to a given simplex handle. Note that the input parameter is not necessarily a cube, it might also
+ * be an edge or vertex of a cube. On the other hand, the output is always indicating the position of
+ * a cube in the data structure.
+ **/
+ inline int get_top_dimensional_coface_of_a_cell(int splx);
+
+ /**
* This procedure compute incidence numbers between cubes. For a cube \f$A\f$ of
* dimension n and a cube \f$B \subset A\f$ of dimension n-1, an incidence
* between \f$A\f$ and \f$B\f$ is the integer with which \f$B\f$ appears in the boundary of \f$A\f$.
@@ -603,6 +611,19 @@ void Bitmap_cubical_complex_base<T>::setup_bitmap_based_on_top_dimensional_cells
}
template <typename T>
+int Bitmap_cubical_complex_base<T>::get_top_dimensional_coface_of_a_cell(int splx) {
+ if (this->get_dimension_of_a_cell(splx) == this->dimension()){return splx;}
+ else{
+ for (auto v : this->get_coboundary_of_a_cell(splx)){
+ if(this->get_cell_data(v) == this->get_cell_data(splx)){
+ return this->get_top_dimensional_coface_of_a_cell(v);
+ }
+ }
+ }
+ return splx;
+}
+
+template <typename T>
Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& sizes_in_following_directions,
const std::vector<T>& top_dimensional_cells) {
this->setup_bitmap_based_on_top_dimensional_cells_list(sizes_in_following_directions, top_dimensional_cells);
diff --git a/src/python/gudhi/cubical_complex.pyx b/src/python/gudhi/cubical_complex.pyx
index 9e701fe6..84fec60e 100644
--- a/src/python/gudhi/cubical_complex.pyx
+++ b/src/python/gudhi/cubical_complex.pyx
@@ -163,7 +163,9 @@ cdef class CubicalComplex:
when calling the function on one of their common faces.
:returns: The top-dimensional cells/cofaces of the positive and negative cells, together with the corresponding homological dimension.
- :rtype: numpy array of integers of shape [number_of_persistence_points, 3], the integers of eah row being: (homological dimension, index of positive top-dimensional cell, index of negative top-dimensional cell). If the homological feature is essential, i.e., if the death time is +infinity, then the index of the corresponding negative top-dimensional cell is -1.
+ :rtype: numpy array of integers of shape [number_of_persistence_points, 3], the integers of eah row being: (homological dimension,
+ index of positive top-dimensional cell, index of negative top-dimensional cell). If the homological feature is essential, i.e., if
+ the death time is +infinity, then the index of the corresponding negative top-dimensional cell is -1.
"""
cdef vector[vector[int]] persistence_result
if self.pcohptr != NULL:
diff --git a/src/python/gudhi/periodic_cubical_complex.pyx b/src/python/gudhi/periodic_cubical_complex.pyx
index ba039e80..993d95c7 100644
--- a/src/python/gudhi/periodic_cubical_complex.pyx
+++ b/src/python/gudhi/periodic_cubical_complex.pyx
@@ -173,7 +173,9 @@ cdef class PeriodicCubicalComplex:
when calling the function on one of their common faces.
:returns: The top-dimensional cells/cofaces of the positive and negative cells, together with the corresponding homological dimension.
- :rtype: numpy array of integers of shape [number_of_persistence_points, 3], the integers of eah row being: (homological dimension, index of positive top-dimensional cell, index of negative top-dimensional cell). If the homological feature is essential, i.e., if the death time is +infinity, then the index of the corresponding negative top-dimensional cell is -1.
+ :rtype: numpy array of integers of shape [number_of_persistence_points, 3], the integers of eah row being: (homological dimension,
+ index of positive top-dimensional cell, index of negative top-dimensional cell). If the homological feature is essential, i.e., if
+ the death time is +infinity, then the index of the corresponding negative top-dimensional cell is -1.
"""
cdef vector[vector[int]] persistence_result
if self.pcohptr != NULL:
diff --git a/src/python/include/Persistent_cohomology_interface.h b/src/python/include/Persistent_cohomology_interface.h
index defac88c..77555349 100644
--- a/src/python/include/Persistent_cohomology_interface.h
+++ b/src/python/include/Persistent_cohomology_interface.h
@@ -72,18 +72,6 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
return persistence;
}
- int top_dimensional_coface(int splx){
- if (stptr_->dimension(splx) == stptr_->dimension()){return splx;}
- else{
- for (auto v : stptr_->get_coboundary_of_a_cell(splx)){
- if(stptr_->filtration(v) == stptr_->filtration(splx)){
- return top_dimensional_coface(v);
- }
- }
- }
- return splx;
- }
-
std::vector<std::vector<int>> cofaces_of_cubical_persistence_pairs() {
// Warning: this function is meant to be used with CubicalComplex only!!
@@ -104,14 +92,14 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
for (auto pair : pairs) {
int h = stptr_->dimension(get<0>(pair));
// Recursively get the top-dimensional cell / coface associated to the persistence generator
- int face0 = top_dimensional_coface(get<0>(pair));
+ int face0 = stptr_->get_top_dimensional_coface_of_a_cell(get<0>(pair));
// Retrieve the index of the corresponding top-dimensional cell in the input data
int splx0 = order[face0];
int splx1 = -1;
if (isfinite(stptr_->filtration(get<1>(pair)))){
// Recursively get the top-dimensional cell / coface associated to the persistence generator
- int face1 = top_dimensional_coface(get<1>(pair));
+ int face1 = stptr_->get_top_dimensional_coface_of_a_cell(get<1>(pair));
// Retrieve the index of the corresponding top-dimensional cell in the input data
splx1 = order[face1];
}