From 359d73955c329b62510b785934f88c38b0525003 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Thu, 8 Sep 2022 16:00:06 +0200 Subject: removal of unused private members --- .../Integer_combination_iterator.h | 159 ++++++++++----------- 1 file changed, 79 insertions(+), 80 deletions(-) (limited to 'src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h') diff --git a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h index 3ee73754..155995f5 100644 --- a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h +++ b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h @@ -25,86 +25,85 @@ typedef unsigned uint; * Based on the algorithm by Mifsud. */ class Integer_combination_iterator - : public boost::iterator_facade const, - boost::forward_traversal_tag> { - using value_t = std::vector; - - private: - friend class boost::iterator_core_access; - - bool equal(Integer_combination_iterator const& other) const { return (is_end_ && other.is_end_); } - - value_t const& dereference() const { return value_; } - - void increment() { - uint j1 = 0; - uint s = 0; - while (value_[j1] == 0 && j1 < k_) j1++; - uint j2 = j1 + 1; - while (value_[j2] == bounds_[j2]) { - if (bounds_[j2] != 0) { - s += value_[j1]; - value_[j1] = 0; - j1 = j2; - } - j2++; - } - if (j2 >= k_) { - is_end_ = true; - return; - } - s += value_[j1] - 1; - value_[j1] = 0; - value_[j2]++; - uint i = 0; - while (s >= bounds_[i]) { - value_[i] = bounds_[i]; - s -= bounds_[i]; - i++; - } - value_[i++] = s; - } - - public: - template - Integer_combination_iterator(const uint& n, const uint& k, const Bound_range& bounds) - : value_(k + 2), is_end_(n == 0 || k == 0), n_(n), k_(k) { - bounds_.reserve(k + 2); - uint sum_radices = 0; - for (auto b : bounds) { - bounds_.push_back(b); - sum_radices += b; - } - bounds_.push_back(2); - bounds_.push_back(1); - if (n > sum_radices) { - is_end_ = true; - return; - } - uint i = 0; - uint s = n; - while (s >= bounds_[i]) { - value_[i] = bounds_[i]; - s -= bounds_[i]; - i++; - } - value_[i++] = s; - - while (i < k_) value_[i++] = 0; - value_[k] = 1; - value_[k + 1] = 0; - } - - // Used for the creating an end iterator - Integer_combination_iterator() : is_end_(true), n_(0), k_(0) {} - - private: - value_t value_; // the dereference value - bool is_end_; // is true when the current integer combination is the final one - - uint n_; - uint k_; - std::vector bounds_; + : public boost::iterator_facade const, + boost::forward_traversal_tag> { + using value_t = std::vector; + +private: + friend class boost::iterator_core_access; + + bool equal(Integer_combination_iterator const& other) const { return (is_end_ && other.is_end_); } + + value_t const& dereference() const { return value_; } + + void increment() { + uint j1 = 0; + uint s = 0; + while (value_[j1] == 0 && j1 < k_) j1++; + uint j2 = j1 + 1; + while (value_[j2] == bounds_[j2]) { + if (bounds_[j2] != 0) { + s += value_[j1]; + value_[j1] = 0; + j1 = j2; + } + j2++; + } + if (j2 >= k_) { + is_end_ = true; + return; + } + s += value_[j1] - 1; + value_[j1] = 0; + value_[j2]++; + uint i = 0; + while (s >= bounds_[i]) { + value_[i] = bounds_[i]; + s -= bounds_[i]; + i++; + } + value_[i++] = s; + } + +public: + template + Integer_combination_iterator(const uint& n, const uint& k, const Bound_range& bounds) + : value_(k + 2), is_end_(n == 0 || k == 0), k_(k) { + bounds_.reserve(k + 2); + uint sum_radices = 0; + for (auto b : bounds) { + bounds_.push_back(b); + sum_radices += b; + } + bounds_.push_back(2); + bounds_.push_back(1); + if (n > sum_radices) { + is_end_ = true; + return; + } + uint i = 0; + uint s = n; + while (s >= bounds_[i]) { + value_[i] = bounds_[i]; + s -= bounds_[i]; + i++; + } + value_[i++] = s; + + while (i < k_) value_[i++] = 0; + value_[k] = 1; + value_[k + 1] = 0; + } + + // Used for the creating an end iterator + Integer_combination_iterator() : is_end_(true), k_(0) {} + +private: + value_t value_; // the dereference value + bool is_end_; // is true when the current integer combination is the final one + + uint k_; + std::vector bounds_; }; } // namespace coxeter_triangulation -- cgit v1.2.3 From 122a9db751c392910fd09097ad50226c2a557a38 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Fri, 9 Sep 2022 11:22:06 +0200 Subject: restore indentation --- .../gudhi/Functions/Function_affine_plane_in_Rd.h | 101 ++++++------- .../gudhi/Functions/Function_moment_curve_in_Rd.h | 96 ++++++------- .../Integer_combination_iterator.h | 159 +++++++++++---------- 3 files changed, 176 insertions(+), 180 deletions(-) (limited to 'src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h') diff --git a/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h b/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h index 58a9fc41..dc6f5f90 100644 --- a/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h +++ b/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h @@ -25,62 +25,63 @@ namespace coxeter_triangulation { * embedded in d-dimensional Euclidean space. */ struct Function_affine_plane_in_Rd { - /** - * \brief Value of the function at a specified point. - * @param[in] p The input point. The dimension needs to coincide with the ambient dimension. - */ - Eigen::VectorXd operator()(const Eigen::VectorXd& p) const { - Eigen::VectorXd result = normal_matrix_.transpose() * (p - off_); - return result; - } + /** + * \brief Value of the function at a specified point. + * @param[in] p The input point. The dimension needs to coincide with the ambient dimension. + */ + Eigen::VectorXd operator()(const Eigen::VectorXd& p) const { + Eigen::VectorXd result = normal_matrix_.transpose() * (p - off_); + return result; + } - /** \brief Returns the domain dimension. Same as the ambient dimension of the sphere. */ - std::size_t amb_d() const { return d_; }; + /** \brief Returns the domain dimension. Same as the ambient dimension of the sphere. */ + std::size_t amb_d() const { return d_; }; - /** \brief Returns the codomain dimension. Same as the codimension of the sphere. */ - std::size_t cod_d() const { return k_; }; + /** \brief Returns the codomain dimension. Same as the codimension of the sphere. */ + std::size_t cod_d() const { return k_; }; - /** \brief Returns a point on the affine plane. */ - Eigen::VectorXd seed() const { - Eigen::VectorXd result = off_; - return result; - } + /** \brief Returns a point on the affine plane. */ + Eigen::VectorXd seed() const { + Eigen::VectorXd result = off_; + return result; + } - /** - * \brief Constructor of the function that defines an m-dimensional implicit affine - * plane in the d-dimensional Euclidean space. - * - * @param[in] normal_matrix A normal matrix of the affine plane. The number of rows should - * correspond to the ambient dimension, the number of columns should correspond to - * the size of the normal basis (codimension). - * @param[in] offset The offset vector of the affine plane. - * The dimension of the vector should be the ambient dimension of the manifold. - */ - Function_affine_plane_in_Rd(const Eigen::MatrixXd& normal_matrix, const Eigen::VectorXd& offset) - : normal_matrix_(normal_matrix), d_(normal_matrix.rows()), k_(normal_matrix.cols()), off_(offset) { - normal_matrix_.colwise().normalize(); - } + /** + * \brief Constructor of the function that defines an m-dimensional implicit affine + * plane in the d-dimensional Euclidean space. + * + * @param[in] normal_matrix A normal matrix of the affine plane. The number of rows should + * correspond to the ambient dimension, the number of columns should correspond to + * the size of the normal basis (codimension). + * @param[in] offset The offset vector of the affine plane. + * The dimension of the vector should be the ambient dimension of the manifold. + */ + Function_affine_plane_in_Rd(const Eigen::MatrixXd& normal_matrix, const Eigen::VectorXd& offset) + : normal_matrix_(normal_matrix), d_(normal_matrix.rows()), k_(normal_matrix.cols()), m_(d_ - k_), off_(offset) { + normal_matrix_.colwise().normalize(); + } - /** - * \brief Constructor of the function that defines an m-dimensional implicit affine - * plane in the d-dimensional Euclidean space that passes through origin. - * - * @param[in] normal_matrix A normal matrix of the affine plane. The number of rows should - * correspond to the ambient dimension, the number of columns should correspond to - * the size of the normal basis (codimension). - */ - Function_affine_plane_in_Rd(const Eigen::MatrixXd& normal_matrix) - : normal_matrix_(normal_matrix), - d_(normal_matrix.rows()), - k_(normal_matrix.cols()), - off_(Eigen::VectorXd::Zero(d_)) { - normal_matrix_.colwise().normalize(); - } + /** + * \brief Constructor of the function that defines an m-dimensional implicit affine + * plane in the d-dimensional Euclidean space that passes through origin. + * + * @param[in] normal_matrix A normal matrix of the affine plane. The number of rows should + * correspond to the ambient dimension, the number of columns should correspond to + * the size of the normal basis (codimension). + */ + Function_affine_plane_in_Rd(const Eigen::MatrixXd& normal_matrix) + : normal_matrix_(normal_matrix), + d_(normal_matrix.rows()), + k_(normal_matrix.cols()), + m_(d_ - k_), + off_(Eigen::VectorXd::Zero(d_)) { + normal_matrix_.colwise().normalize(); + } -private: - Eigen::MatrixXd normal_matrix_; - std::size_t d_, k_; - Eigen::VectorXd off_; + private: + Eigen::MatrixXd normal_matrix_; + std::size_t d_, k_, m_; + Eigen::VectorXd off_; }; } // namespace coxeter_triangulation diff --git a/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h b/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h index d44cdf70..11b379f3 100644 --- a/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h +++ b/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h @@ -25,57 +25,51 @@ namespace coxeter_triangulation { * in the d-dimensional Euclidean space. */ struct Function_moment_curve_in_Rd { -public: - /** \brief Value of the function at a specified point. - * @param[in] p The input point. The dimension needs to coincide with the ambient dimension. - */ - Eigen::VectorXd operator()(const Eigen::VectorXd& p) const { - Eigen::VectorXd result(k_); - for (std::size_t i = 1; i < d_; ++i) result(i - 1) = p(i) - p(0) * p(i - 1); - return result; - } - - /** \brief Returns the domain (ambient) dimension.. */ - std::size_t amb_d() const { return d_; }; - - /** \brief Returns the codomain dimension. */ - std::size_t cod_d() const { return k_; }; - - /** \brief Returns a point on the moment curve. */ - Eigen::VectorXd seed() const { - Eigen::VectorXd result = Eigen::VectorXd::Zero(d_); - return result; - } - - /** @brief Returns the radius of the moment curve. */ - double get_radius() const{ - return r_; - } - - /** - * \brief Constructor of the function that defines an implicit moment curve - * in the d-dimensional Euclidean space. - * - * @param[in] r Numerical parameter. - * @param[in] d The ambient dimension. - */ - Function_moment_curve_in_Rd(double r, std::size_t d) : k_(d - 1), d_(d), r_(r) {} - - /** - * \brief Constructor of the function that defines an implicit moment curve - * in the d-dimensional Euclidean space. - * - * @param[in] r Numerical parameter. - * @param[in] d The ambient dimension. - * @param[in] offset The offset of the moment curve. - */ - Function_moment_curve_in_Rd(double r, std::size_t d, Eigen::VectorXd& offset) - : k_(d - 1), d_(d), r_(r), off_(offset) {} - -private: - std::size_t k_, d_; - double r_; - Eigen::VectorXd off_; + /** \brief Value of the function at a specified point. + * @param[in] p The input point. The dimension needs to coincide with the ambient dimension. + */ + Eigen::VectorXd operator()(const Eigen::VectorXd& p) const { + Eigen::VectorXd result(k_); + for (std::size_t i = 1; i < d_; ++i) result(i - 1) = p(i) - p(0) * p(i - 1); + return result; + } + + /** \brief Returns the domain (ambient) dimension.. */ + std::size_t amb_d() const { return d_; }; + + /** \brief Returns the codomain dimension. */ + std::size_t cod_d() const { return k_; }; + + /** \brief Returns a point on the moment curve. */ + Eigen::VectorXd seed() const { + Eigen::VectorXd result = Eigen::VectorXd::Zero(d_); + return result; + } + + /** + * \brief Constructor of the function that defines an implicit moment curve + * in the d-dimensional Euclidean space. + * + * @param[in] r Numerical parameter. + * @param[in] d The ambient dimension. + */ + Function_moment_curve_in_Rd(double r, std::size_t d) : m_(1), k_(d - 1), d_(d), r_(r) {} + + /** + * \brief Constructor of the function that defines an implicit moment curve + * in the d-dimensional Euclidean space. + * + * @param[in] r Numerical parameter. + * @param[in] d The ambient dimension. + * @param[in] offset The offset of the moment curve. + */ + Function_moment_curve_in_Rd(double r, std::size_t d, Eigen::VectorXd& offset) + : m_(1), k_(d - 1), d_(d), r_(r), off_(offset) {} + + private: + std::size_t m_, k_, d_; + double r_; + Eigen::VectorXd off_; }; } // namespace coxeter_triangulation diff --git a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h index 155995f5..3ee73754 100644 --- a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h +++ b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h @@ -25,85 +25,86 @@ typedef unsigned uint; * Based on the algorithm by Mifsud. */ class Integer_combination_iterator - : public boost::iterator_facade const, - boost::forward_traversal_tag> { - using value_t = std::vector; - -private: - friend class boost::iterator_core_access; - - bool equal(Integer_combination_iterator const& other) const { return (is_end_ && other.is_end_); } - - value_t const& dereference() const { return value_; } - - void increment() { - uint j1 = 0; - uint s = 0; - while (value_[j1] == 0 && j1 < k_) j1++; - uint j2 = j1 + 1; - while (value_[j2] == bounds_[j2]) { - if (bounds_[j2] != 0) { - s += value_[j1]; - value_[j1] = 0; - j1 = j2; - } - j2++; - } - if (j2 >= k_) { - is_end_ = true; - return; - } - s += value_[j1] - 1; - value_[j1] = 0; - value_[j2]++; - uint i = 0; - while (s >= bounds_[i]) { - value_[i] = bounds_[i]; - s -= bounds_[i]; - i++; - } - value_[i++] = s; - } - -public: - template - Integer_combination_iterator(const uint& n, const uint& k, const Bound_range& bounds) - : value_(k + 2), is_end_(n == 0 || k == 0), k_(k) { - bounds_.reserve(k + 2); - uint sum_radices = 0; - for (auto b : bounds) { - bounds_.push_back(b); - sum_radices += b; - } - bounds_.push_back(2); - bounds_.push_back(1); - if (n > sum_radices) { - is_end_ = true; - return; - } - uint i = 0; - uint s = n; - while (s >= bounds_[i]) { - value_[i] = bounds_[i]; - s -= bounds_[i]; - i++; - } - value_[i++] = s; - - while (i < k_) value_[i++] = 0; - value_[k] = 1; - value_[k + 1] = 0; - } - - // Used for the creating an end iterator - Integer_combination_iterator() : is_end_(true), k_(0) {} - -private: - value_t value_; // the dereference value - bool is_end_; // is true when the current integer combination is the final one - - uint k_; - std::vector bounds_; + : public boost::iterator_facade const, + boost::forward_traversal_tag> { + using value_t = std::vector; + + private: + friend class boost::iterator_core_access; + + bool equal(Integer_combination_iterator const& other) const { return (is_end_ && other.is_end_); } + + value_t const& dereference() const { return value_; } + + void increment() { + uint j1 = 0; + uint s = 0; + while (value_[j1] == 0 && j1 < k_) j1++; + uint j2 = j1 + 1; + while (value_[j2] == bounds_[j2]) { + if (bounds_[j2] != 0) { + s += value_[j1]; + value_[j1] = 0; + j1 = j2; + } + j2++; + } + if (j2 >= k_) { + is_end_ = true; + return; + } + s += value_[j1] - 1; + value_[j1] = 0; + value_[j2]++; + uint i = 0; + while (s >= bounds_[i]) { + value_[i] = bounds_[i]; + s -= bounds_[i]; + i++; + } + value_[i++] = s; + } + + public: + template + Integer_combination_iterator(const uint& n, const uint& k, const Bound_range& bounds) + : value_(k + 2), is_end_(n == 0 || k == 0), n_(n), k_(k) { + bounds_.reserve(k + 2); + uint sum_radices = 0; + for (auto b : bounds) { + bounds_.push_back(b); + sum_radices += b; + } + bounds_.push_back(2); + bounds_.push_back(1); + if (n > sum_radices) { + is_end_ = true; + return; + } + uint i = 0; + uint s = n; + while (s >= bounds_[i]) { + value_[i] = bounds_[i]; + s -= bounds_[i]; + i++; + } + value_[i++] = s; + + while (i < k_) value_[i++] = 0; + value_[k] = 1; + value_[k + 1] = 0; + } + + // Used for the creating an end iterator + Integer_combination_iterator() : is_end_(true), n_(0), k_(0) {} + + private: + value_t value_; // the dereference value + bool is_end_; // is true when the current integer combination is the final one + + uint n_; + uint k_; + std::vector bounds_; }; } // namespace coxeter_triangulation -- cgit v1.2.3 From 7b10950f7875793b3b2cbab15bacdeefed06d278 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Fri, 9 Sep 2022 11:23:03 +0200 Subject: restore indentation part 2 --- .../include/gudhi/Functions/Function_affine_plane_in_Rd.h | 5 ++--- .../include/gudhi/Functions/Function_moment_curve_in_Rd.h | 11 ++++++++--- .../Integer_combination_iterator.h | 5 ++--- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h') diff --git a/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h b/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h index dc6f5f90..a9e2d507 100644 --- a/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h +++ b/src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h @@ -57,7 +57,7 @@ struct Function_affine_plane_in_Rd { * The dimension of the vector should be the ambient dimension of the manifold. */ Function_affine_plane_in_Rd(const Eigen::MatrixXd& normal_matrix, const Eigen::VectorXd& offset) - : normal_matrix_(normal_matrix), d_(normal_matrix.rows()), k_(normal_matrix.cols()), m_(d_ - k_), off_(offset) { + : normal_matrix_(normal_matrix), d_(normal_matrix.rows()), k_(normal_matrix.cols()), off_(offset) { normal_matrix_.colwise().normalize(); } @@ -73,14 +73,13 @@ struct Function_affine_plane_in_Rd { : normal_matrix_(normal_matrix), d_(normal_matrix.rows()), k_(normal_matrix.cols()), - m_(d_ - k_), off_(Eigen::VectorXd::Zero(d_)) { normal_matrix_.colwise().normalize(); } private: Eigen::MatrixXd normal_matrix_; - std::size_t d_, k_, m_; + std::size_t d_, k_; Eigen::VectorXd off_; }; diff --git a/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h b/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h index 11b379f3..f315d794 100644 --- a/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h +++ b/src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h @@ -46,6 +46,11 @@ struct Function_moment_curve_in_Rd { return result; } + /** @brief Returns the radius of the moment curve. */ + double get_radius() const{ + return r_; + } + /** * \brief Constructor of the function that defines an implicit moment curve * in the d-dimensional Euclidean space. @@ -53,7 +58,7 @@ struct Function_moment_curve_in_Rd { * @param[in] r Numerical parameter. * @param[in] d The ambient dimension. */ - Function_moment_curve_in_Rd(double r, std::size_t d) : m_(1), k_(d - 1), d_(d), r_(r) {} + Function_moment_curve_in_Rd(double r, std::size_t d) : k_(d - 1), d_(d), r_(r) {} /** * \brief Constructor of the function that defines an implicit moment curve @@ -64,10 +69,10 @@ struct Function_moment_curve_in_Rd { * @param[in] offset The offset of the moment curve. */ Function_moment_curve_in_Rd(double r, std::size_t d, Eigen::VectorXd& offset) - : m_(1), k_(d - 1), d_(d), r_(r), off_(offset) {} + : k_(d - 1), d_(d), r_(r), off_(offset) {} private: - std::size_t m_, k_, d_; + std::size_t k_, d_; double r_; Eigen::VectorXd off_; }; diff --git a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h index 3ee73754..594b6fbf 100644 --- a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h +++ b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h @@ -68,7 +68,7 @@ class Integer_combination_iterator public: template Integer_combination_iterator(const uint& n, const uint& k, const Bound_range& bounds) - : value_(k + 2), is_end_(n == 0 || k == 0), n_(n), k_(k) { + : value_(k + 2), is_end_(n == 0 || k == 0), k_(k) { bounds_.reserve(k + 2); uint sum_radices = 0; for (auto b : bounds) { @@ -96,13 +96,12 @@ class Integer_combination_iterator } // Used for the creating an end iterator - Integer_combination_iterator() : is_end_(true), n_(0), k_(0) {} + Integer_combination_iterator() : is_end_(true), k_(0) {} private: value_t value_; // the dereference value bool is_end_; // is true when the current integer combination is the final one - uint n_; uint k_; std::vector bounds_; }; -- cgit v1.2.3