From ee92004d1d860f1cb95d086095401f3d9e23788b Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 4 Jun 2019 11:15:27 +0200 Subject: Fix #9 : rename Complex_ds as FilteredComplex. Set private types of non-exposed types --- .../include/gudhi/Persistent_cohomology.h | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h') diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index c51e47a5..ca697450 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -63,12 +63,15 @@ namespace persistent_cohomology { template class Persistent_cohomology { public: - typedef FilteredComplex Complex_ds; // Data attached to each simplex to interface with a Property Map. - typedef typename Complex_ds::Simplex_key Simplex_key; - typedef typename Complex_ds::Simplex_handle Simplex_handle; - typedef typename Complex_ds::Filtration_value Filtration_value; + typedef typename FilteredComplex::Simplex_key Simplex_key; + typedef typename FilteredComplex::Simplex_handle Simplex_handle; + typedef typename FilteredComplex::Filtration_value Filtration_value; typedef typename CoefficientField::Element Arith_element; + /** \brief Persistent interval type. The Arith_element field is used for the multi-field framework. */ + typedef std::tuple Persistent_interval; + + private: // Compressed Annotation Matrix types: // Column type typedef Persistent_cohomology_column Column; // contains 1 set_hook @@ -83,16 +86,15 @@ class Persistent_cohomology { boost::intrusive::constant_time_size > Cam; // Sparse column type for the annotation of the boundary of an element. typedef std::vector > A_ds_type; - // Persistent interval type. The Arith_element field is used for the multi-field framework. - typedef std::tuple Persistent_interval; + public: /** \brief Initializes the Persistent_cohomology class. * * @param[in] cpx Complex for which the persistent homology is computed. * cpx is a model of FilteredComplex * @exception std::out_of_range In case the number of simplices is more than Simplex_key type numeric limit. */ - explicit Persistent_cohomology(Complex_ds& cpx) + explicit Persistent_cohomology(FilteredComplex& cpx) : cpx_(&cpx), dim_max_(cpx.dimension()), // upper bound on the dimension of the simplices coeff_field_(), // initialize the field coefficient structure. @@ -128,7 +130,7 @@ class Persistent_cohomology { * @param[in] persistence_dim_max if true, the persistent homology for the maximal dimension in the * complex is computed. If false, it is ignored. Default is false. */ - Persistent_cohomology(Complex_ds& cpx, bool persistence_dim_max) + Persistent_cohomology(FilteredComplex& cpx, bool persistence_dim_max) : Persistent_cohomology(cpx) { if (persistence_dim_max) { ++dim_max_; @@ -146,7 +148,7 @@ class Persistent_cohomology { private: struct length_interval { - length_interval(Complex_ds * cpx, Filtration_value min_length) + length_interval(FilteredComplex * cpx, Filtration_value min_length) : cpx_(cpx), min_length_(min_length) { } @@ -159,7 +161,7 @@ class Persistent_cohomology { min_length_ = new_length; } - Complex_ds * cpx_; + FilteredComplex * cpx_; Filtration_value min_length_; }; @@ -552,14 +554,14 @@ class Persistent_cohomology { * Compare two intervals by length. */ struct cmp_intervals_by_length { - explicit cmp_intervals_by_length(Complex_ds * sc) + explicit cmp_intervals_by_length(FilteredComplex * sc) : sc_(sc) { } bool operator()(const Persistent_interval & p1, const Persistent_interval & p2) { return (sc_->filtration(get < 1 > (p1)) - sc_->filtration(get < 0 > (p1)) > sc_->filtration(get < 1 > (p2)) - sc_->filtration(get < 0 > (p2))); } - Complex_ds * sc_; + FilteredComplex * sc_; }; public: @@ -733,7 +735,7 @@ class Persistent_cohomology { }; public: - Complex_ds * cpx_; + FilteredComplex * cpx_; int dim_max_; CoefficientField coeff_field_; size_t num_simplices_; -- cgit v1.2.3 From 733c9efab57e489e849d32123a69ac090d3c585a Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 4 Jun 2019 17:21:59 +0200 Subject: Fix #7 : document better get_persistence_pairs (C++) and persistence_pairs (Python) methods --- .../include/gudhi/Persistent_cohomology.h | 12 ++++++++---- src/cython/cython/simplex_tree.pyx | 5 ++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h') diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index ca697450..452527c4 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -64,13 +64,18 @@ template class Persistent_cohomology { public: // Data attached to each simplex to interface with a Property Map. + + /** \brief Data stored for each simplex. */ typedef typename FilteredComplex::Simplex_key Simplex_key; + /** \brief Handle to specify a simplex. */ typedef typename FilteredComplex::Simplex_handle Simplex_handle; + /** \brief Type for the value of the filtration function. */ typedef typename FilteredComplex::Filtration_value Filtration_value; + /** \brief Type of element of the field. */ typedef typename CoefficientField::Element Arith_element; /** \brief Persistent interval type. The Arith_element field is used for the multi-field framework. */ typedef std::tuple Persistent_interval; - + private: // Compressed Annotation Matrix types: // Column type @@ -692,9 +697,8 @@ class Persistent_cohomology { return betti_number; } - /** @brief Returns the persistent pairs. - * @return Persistent pairs - * + /** @brief Returns a list of persistence birth and death FilteredComplex::Simplex_handle pairs. + * @return A list of Persistent_cohomology::Persistent_interval */ const std::vector& get_persistent_pairs() const { return persistent_pairs_; diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index a38e309d..ea99c940 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -514,10 +514,9 @@ cdef class SimplexTree: return intervals_result def persistence_pairs(self): - """This function returns the persistence pairs of the simplicial - complex. + """This function returns a list of persistence birth and death simplices pairs. - :returns: The persistence intervals. + :returns: A list of persistence simplices intervals. :rtype: list of pair of list of int :note: persistence_pairs function requires -- cgit v1.2.3 From ef5fcf9e54e0c14f7c2e7eebb5c24fb91018606a Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 6 Jun 2019 10:38:07 +0200 Subject: Fix doc review --- src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h') diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index 452527c4..c57174cb 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -73,7 +73,8 @@ class Persistent_cohomology { typedef typename FilteredComplex::Filtration_value Filtration_value; /** \brief Type of element of the field. */ typedef typename CoefficientField::Element Arith_element; - /** \brief Persistent interval type. The Arith_element field is used for the multi-field framework. */ + /** \brief Type for birth and death FilteredComplex::Simplex_handle. + * The Arith_element field is used for the multi-field framework. */ typedef std::tuple Persistent_interval; private: -- cgit v1.2.3