diff options
Diffstat (limited to 'src/Witness_complex/include')
5 files changed, 27 insertions, 29 deletions
diff --git a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h index 4e29a40d..0a05173a 100644 --- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h +++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h @@ -36,7 +36,6 @@ namespace witness_complex { * If all the landmarks are present in the list, iterator returns the specific end value * of the corresponding 'Active_witness' object. */ - template< typename Active_witness, typename Id_distance_pair, typename INS_iterator > @@ -47,15 +46,14 @@ class Active_witness_iterator Id_distance_pair const> { friend class boost::iterator_core_access; - //typedef Active_witness<Id_distance_pair, INS_iterator> Active_witness; typedef typename std::list<Id_distance_pair>::iterator Pair_iterator; typedef typename Gudhi::witness_complex::Active_witness_iterator<Active_witness, Id_distance_pair, INS_iterator> Iterator; Active_witness *aw_; - Pair_iterator lh_; // landmark handle - bool is_end_; // true only if the pointer is end and there are no more neighbors to add + Pair_iterator lh_; // landmark handle + bool is_end_; // true only if the pointer is end and there are no more neighbors to add public: Active_witness_iterator(Active_witness* aw) @@ -87,7 +85,8 @@ class Active_witness_iterator void increment() { // the neighbor search can't be at the end iterator of a list - GUDHI_CHECK(!is_end_ && lh_ != aw_->nearest_landmark_table_.end(), std::logic_error("Wrong active witness increment.")); + GUDHI_CHECK(!is_end_ && lh_ != aw_->nearest_landmark_table_.end(), + std::logic_error("Wrong active witness increment.")); // if the id of the current landmark is the same as the last one lh_++; @@ -105,5 +104,5 @@ class Active_witness_iterator } // namespace witness_complex } // namespace Gudhi - + #endif // ACTIVE_WITNESS_ACTIVE_WITNESS_ITERATOR_H_ diff --git a/src/Witness_complex/include/gudhi/Euclidean_strong_witness_complex.h b/src/Witness_complex/include/gudhi/Euclidean_strong_witness_complex.h index 6870c183..fb669ef8 100644 --- a/src/Witness_complex/include/gudhi/Euclidean_strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Euclidean_strong_witness_complex.h @@ -83,13 +83,13 @@ class Euclidean_strong_witness_complex const WitnessRange & witnesses) : landmarks_(std::begin(landmarks), std::end(landmarks)), landmark_tree_(landmarks_) { nearest_landmark_table_.reserve(boost::size(witnesses)); - for (auto w: witnesses) + for (auto w : witnesses) nearest_landmark_table_.push_back(landmark_tree_.query_incremental_nearest_neighbors(w)); } /** \brief Returns the point corresponding to the given vertex. */ - template <typename Vertex_handle> + template <typename Vertex_handle> Point_d get_point(Vertex_handle vertex) const { return landmarks_[vertex]; } @@ -101,4 +101,4 @@ class Euclidean_strong_witness_complex } // namespace Gudhi -#endif // EUCLIDEAN_STRONG_WITNESS_COMPLEX_H_ +#endif // EUCLIDEAN_STRONG_WITNESS_COMPLEX_H_ diff --git a/src/Witness_complex/include/gudhi/Euclidean_witness_complex.h b/src/Witness_complex/include/gudhi/Euclidean_witness_complex.h index 146271f7..6afe9a5d 100644 --- a/src/Witness_complex/include/gudhi/Euclidean_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Euclidean_witness_complex.h @@ -33,7 +33,7 @@ #include <limits> namespace Gudhi { - + namespace witness_complex { /** @@ -46,8 +46,10 @@ namespace witness_complex { * href="http://doc.cgal.org/latest/Kernel_d/classCGAL_1_1Epick__d.html">CGAL::Epick_d</a> class. */ template< class Kernel_ > -class Euclidean_witness_complex : public Witness_complex<std::vector<typename Gudhi::spatial_searching::Kd_tree_search<Kernel_, std::vector<typename Kernel_::Point_d>>::INS_range>> { -private: +class Euclidean_witness_complex + : public Witness_complex<std::vector<typename Gudhi::spatial_searching::Kd_tree_search<Kernel_, + std::vector<typename Kernel_::Point_d>>::INS_range>> { + private: typedef Kernel_ K; typedef typename K::Point_d Point_d; typedef std::vector<Point_d> Point_range; @@ -64,7 +66,7 @@ private: Kd_tree landmark_tree_; using Witness_complex<Nearest_landmark_table>::nearest_landmark_table_; -public: + public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* @name Constructor */ @@ -81,24 +83,22 @@ public: typename WitnessRange > Euclidean_witness_complex(const LandmarkRange & landmarks, const WitnessRange & witnesses) - : landmarks_(std::begin(landmarks), std::end(landmarks)), landmark_tree_(landmarks) - { + : landmarks_(std::begin(landmarks), std::end(landmarks)), landmark_tree_(landmarks) { nearest_landmark_table_.reserve(boost::size(witnesses)); - for (auto w: witnesses) + for (auto w : witnesses) nearest_landmark_table_.push_back(landmark_tree_.query_incremental_nearest_neighbors(w)); } /** \brief Returns the point corresponding to the given vertex. * @param[in] vertex Vertex handle of the point to retrieve. */ - Point_d get_point( Vertex_handle vertex ) const - { + Point_d get_point(Vertex_handle vertex) const { return landmarks_[vertex]; } //@} }; - + } // namespace witness_complex } // namespace Gudhi diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 3fbbb366..6708ac29 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -79,8 +79,8 @@ class Strong_witness_complex { * The range of pairs must admit a member type 'iterator'. The dereference type * of the pair range iterator needs to be 'std::pair<std::size_t, double>'. */ - Strong_witness_complex(Nearest_landmark_table_ const & nearest_landmark_table) - : nearest_landmark_table_(std::begin(nearest_landmark_table), std::end(nearest_landmark_table)) { + Strong_witness_complex(Nearest_landmark_table_ const & nearest_landmark_table) + : nearest_landmark_table_(std::begin(nearest_landmark_table), std::end(nearest_landmark_table)) { } /** \brief Outputs the strong witness complex of relaxation 'max_alpha_square' @@ -110,7 +110,7 @@ class Strong_witness_complex { std::cerr << "Strong witness complex cannot create complex - limit dimension must be non-negative.\n"; return false; } - for (auto w: nearest_landmark_table_) { + for (auto w : nearest_landmark_table_) { ActiveWitness aw(w); typeVectorVertex simplex; typename ActiveWitness::iterator aw_it = aw.begin(); @@ -121,7 +121,7 @@ class Strong_witness_complex { aw_it++; } // continue inserting limD-faces of the following simplices - typeVectorVertex& vertices = simplex; //'simplex' now will be called vertices + typeVectorVertex& vertices = simplex; // 'simplex' now will be called vertices while (aw_it != aw.end() && aw_it->second < lim_dist2) { typeVectorVertex facet = {}; add_all_faces_of_dimension(limit_dimension, vertices, vertices.begin(), aw_it, @@ -153,7 +153,7 @@ class Strong_witness_complex { if (dim > 0) { while (curr_it != vertices.end()) { simplex.push_back(*curr_it); - ++curr_it; + ++curr_it; add_all_faces_of_dimension(dim-1, vertices, curr_it, @@ -169,14 +169,13 @@ class Strong_witness_complex { filtration_value, simplex, sc); - } + } } else if (dim == 0) { simplex.push_back(aw_it->first); sc.insert_simplex_and_subfaces(simplex, filtration_value); simplex.pop_back(); - } - } - + } + } //@} }; diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index c0506367..a79bf294 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -183,7 +183,7 @@ class Witness_complex { simplex.push_back(l_it->first); double filtration_value = 0; // if norelax_dist is infinite, relaxation is 0. - if (l_it->second > norelax_dist2) + if (l_it->second > norelax_dist2) filtration_value = l_it->second - norelax_dist2; if (all_faces_in(simplex, &filtration_value, sc)) { will_be_active = true; |