diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-09-22 18:12:31 +0200 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-09-22 18:12:31 +0200 |
commit | be7555abfb97f02c37de96736f7a0993d4d47f03 (patch) | |
tree | 180f618a1db3a8b866f43f66210ac38c028d74dd /src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/face_from_indices.h | |
parent | e0041b766b647f3906b52f861e97edba1f089312 (diff) |
clang-format files
Diffstat (limited to 'src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/face_from_indices.h')
-rw-r--r-- | src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/face_from_indices.h | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/face_from_indices.h b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/face_from_indices.h index 21ee3c8b..47120689 100644 --- a/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/face_from_indices.h +++ b/src/Coxeter_triangulation/include/gudhi/Permutahedral_representation/face_from_indices.h @@ -11,23 +11,23 @@ #ifndef PERMUTAHEDRAL_REPRESENTATION_FACE_FROM_INDICES_H_ #define PERMUTAHEDRAL_REPRESENTATION_FACE_FROM_INDICES_H_ +#include <cstdlib> // for std::size_t +#include <algorithm> + namespace Gudhi { namespace coxeter_triangulation { -#include <cstdlib> // for std::size_t -#include <algorithm> - - /** \brief Computes the permutahedral representation of a face of a given simplex - * and a range of the vertex indices that compose the face. - * - * \tparam Permutahedral_representation has to be Permutahedral_representation - * \tparam Index_range is a range of unsigned integers taking values in 0,...,k, - * where k is the dimension of the simplex simplex. - * - * @param[in] simplex Input simplex. - * @param[in] indices Input range of indices. - */ +/** \brief Computes the permutahedral representation of a face of a given simplex + * and a range of the vertex indices that compose the face. + * + * \tparam Permutahedral_representation has to be Permutahedral_representation + * \tparam Index_range is a range of unsigned integers taking values in 0,...,k, + * where k is the dimension of the simplex simplex. + * + * @param[in] simplex Input simplex. + * @param[in] indices Input range of indices. + */ template <class Permutahedral_representation, class Index_range> Permutahedral_representation face_from_indices(const Permutahedral_representation& simplex, const Index_range& indices) { @@ -38,34 +38,29 @@ Permutahedral_representation face_from_indices(const Permutahedral_representatio Permutahedral_representation value; std::size_t d = simplex.vertex().size(); value.vertex() = simplex.vertex(); - std::size_t k = indices.size()-1; - value.partition().resize(k+1); - std::size_t l = simplex.partition().size()-1; - for (std::size_t h = 1; h < k+1; h++) - for (range_index i = indices[h-1]; i < indices[h]; i++) - for (part_index j: simplex.partition()[i]) - value.partition()[h-1].push_back(j); - for (range_index i = indices[k]; i < l+1; i++) - for (part_index j: simplex.partition()[i]) - value.partition()[k].push_back(j); + std::size_t k = indices.size() - 1; + value.partition().resize(k + 1); + std::size_t l = simplex.partition().size() - 1; + for (std::size_t h = 1; h < k + 1; h++) + for (range_index i = indices[h - 1]; i < indices[h]; i++) + for (part_index j : simplex.partition()[i]) value.partition()[h - 1].push_back(j); + for (range_index i = indices[k]; i < l + 1; i++) + for (part_index j : simplex.partition()[i]) value.partition()[k].push_back(j); for (range_index i = 0; i < indices[0]; i++) - for (part_index j: simplex.partition()[i]) { + for (part_index j : simplex.partition()[i]) { if (j != d) - value.vertex()[j]++; + value.vertex()[j]++; else - for (std::size_t l = 0; l < d; l++) - value.vertex()[l]--; + for (std::size_t l = 0; l < d; l++) value.vertex()[l]--; value.partition()[k].push_back(j); } // sort the values in each part (probably not needed) - for (auto& part: value.partition()) - std::sort(part.begin(), part.end()); + for (auto& part : value.partition()) std::sort(part.begin(), part.end()); return value; } -} // namespace coxeter_triangulation - -} // namespace Gudhi +} // namespace coxeter_triangulation +} // namespace Gudhi #endif |