summaryrefslogtreecommitdiff
path: root/src/Coxeter_triangulation
diff options
context:
space:
mode:
authorhschreiber <hannah.schreiber.k@gmail.com>2022-09-09 11:22:06 +0200
committerhschreiber <hannah.schreiber.k@gmail.com>2022-09-09 11:22:06 +0200
commit122a9db751c392910fd09097ad50226c2a557a38 (patch)
treeec4c67607fc8e276020a0ac77337cab4a2fcca63 /src/Coxeter_triangulation
parent82d7f179d7db317cfe8714bf679f50739bab1173 (diff)
restore indentation
Diffstat (limited to 'src/Coxeter_triangulation')
-rw-r--r--src/Coxeter_triangulation/include/gudhi/Functions/Function_affine_plane_in_Rd.h101
-rw-r--r--src/Coxeter_triangulation/include/gudhi/Functions/Function_moment_curve_in_Rd.h96
-rw-r--r--src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/Integer_combination_iterator.h159
3 files changed, 176 insertions, 180 deletions
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<Integer_combination_iterator, std::vector<uint> const,
- boost::forward_traversal_tag> {
- using value_t = std::vector<uint>;
-
-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 <class Bound_range>
- 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<uint> bounds_;
+ : public boost::iterator_facade<Integer_combination_iterator, std::vector<uint> const,
+ boost::forward_traversal_tag> {
+ using value_t = std::vector<uint>;
+
+ 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 <class Bound_range>
+ 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<uint> bounds_;
};
} // namespace coxeter_triangulation