diff options
Diffstat (limited to 'src/Persistent_cohomology')
-rw-r--r-- | src/Persistent_cohomology/concept/FilteredComplex.h | 25 | ||||
-rw-r--r-- | src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h | 39 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/Persistent_cohomology/concept/FilteredComplex.h b/src/Persistent_cohomology/concept/FilteredComplex.h index 62b9002f..7eb01b01 100644 --- a/src/Persistent_cohomology/concept/FilteredComplex.h +++ b/src/Persistent_cohomology/concept/FilteredComplex.h @@ -27,7 +27,7 @@ */ struct FilteredComplex { -/** Handle to specify a simplex. */ +/** \brief Handle to specify a simplex. */ typedef unspecified Simplex_handle; /** \brief Type for the value of the filtration function. * @@ -39,8 +39,7 @@ struct FilteredComplex * is model of IndexingTag. */ typedef unspecified Indexing_tag; -/** Returns a Simplex_handle that is different from all simplex handles - * of the simplices. */ +/** \brief Returns a Simplex_handle that is different from all simplex handles of the simplices. */ Simplex_handle null_simplex(); /** \brief Returns the number of simplices in the complex. * @@ -58,22 +57,19 @@ struct FilteredComplex * * This is only called on valid indices. */ Simplex_handle simplex ( size_t idx ); -/** \brief Iterator on the simplices belonging to the - * boundary of a simplex. +/** \brief Iterator on the simplices belonging to the boundary of a simplex. * * <CODE>value_type</CODE> must be 'Simplex_handle'. */ typedef unspecified Boundary_simplex_iterator; -/** \brief Range giving access to the simplices in the boundary of - * a simplex. +/** \brief Range giving access to the simplices in the boundary of a simplex. * * .begin() and .end() return type Boundary_simplex_iterator. */ typedef unspecified Boundary_simplex_range; -/** \brief Returns a range giving access to all simplices of the - * boundary of a simplex, i.e. - * the set of codimension 1 subsimplices of the Simplex. +/** \brief Returns a range giving access to all simplices of the boundary of a simplex, i.e. the set of codimension 1 + * subsimplices of the Simplex. * * If the simplex is \f$[v_0, \cdots ,v_d]\f$, with canonical orientation * induced by \f$ v_0 < \cdots < v_d \f$, the iterator enumerates the @@ -84,19 +80,16 @@ typedef unspecified Boundary_simplex_range; * gives the chains corresponding to the boundary of the simplex.*/ Boundary_simplex_range boundary_simplex_range(Simplex_handle sh); -/** \brief Iterator over all simplices of the complex - * in the order of the indexing scheme. +/** \brief Iterator over all simplices of the complex in the order of the indexing scheme. * * 'value_type' must be 'Simplex_handle'. */ typedef unspecified Filtration_simplex_iterator; -/** \brief Range over the simplices of the complex - * in the order of the filtration. +/** \brief Range over the simplices of the complex in the order of the filtration. * * .begin() and .end() return type Filtration_simplex_iterator.*/ typedef unspecified Filtration_simplex_range; -/** \brief Returns a range over the simplices of the complex - * in the order of the filtration. +/** \brief Returns a range over the simplices of the complex in the order of the filtration. * * .begin() and .end() return type Filtration_simplex_iterator.*/ Filtration_simplex_range filtration_simplex_range(); diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index c51e47a5..c57174cb 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -63,12 +63,21 @@ namespace persistent_cohomology { template<class FilteredComplex, class CoefficientField> 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; + + /** \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 Type for birth and death FilteredComplex::Simplex_handle. + * The Arith_element field is used for the multi-field framework. */ + typedef std::tuple<Simplex_handle, Simplex_handle, Arith_element> Persistent_interval; + + private: // Compressed Annotation Matrix types: // Column type typedef Persistent_cohomology_column<Simplex_key, Arith_element> Column; // contains 1 set_hook @@ -83,16 +92,15 @@ class Persistent_cohomology { boost::intrusive::constant_time_size<false> > Cam; // Sparse column type for the annotation of the boundary of an element. typedef std::vector<std::pair<Simplex_key, Arith_element> > A_ds_type; - // Persistent interval type. The Arith_element field is used for the multi-field framework. - typedef std::tuple<Simplex_handle, Simplex_handle, Arith_element> 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 +136,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 +154,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 +167,7 @@ class Persistent_cohomology { min_length_ = new_length; } - Complex_ds * cpx_; + FilteredComplex * cpx_; Filtration_value min_length_; }; @@ -552,14 +560,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: @@ -690,9 +698,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<Persistent_interval>& get_persistent_pairs() const { return persistent_pairs_; @@ -733,7 +740,7 @@ class Persistent_cohomology { }; public: - Complex_ds * cpx_; + FilteredComplex * cpx_; int dim_max_; CoefficientField coeff_field_; size_t num_simplices_; |