11#ifndef PERMUTAHEDRAL_REPRESENTATION_FACE_FROM_INDICES_H_
12#define PERMUTAHEDRAL_REPRESENTATION_FACE_FROM_INDICES_H_
19namespace coxeter_triangulation {
31template <
class Permutahedral_representation,
class Index_range>
32Permutahedral_representation face_from_indices(
const Permutahedral_representation& simplex,
33 const Index_range& indices) {
34 using range_index =
typename Index_range::value_type;
36 using Part =
typename Ordered_set_partition::value_type;
37 using part_index =
typename Part::value_type;
38 Permutahedral_representation value;
39 std::size_t d = simplex.vertex().size();
40 value.vertex() = simplex.vertex();
41 std::size_t k = indices.size() - 1;
42 value.partition().resize(k + 1);
43 std::size_t l = simplex.partition().size() - 1;
44 for (std::size_t h = 1; h < k + 1; h++)
45 for (range_index i = indices[h - 1]; i < indices[h]; i++)
46 for (part_index j : simplex.partition()[i]) value.partition()[h - 1].push_back(j);
47 for (range_index i = indices[k]; i < l + 1; i++)
48 for (part_index j : simplex.partition()[i]) value.partition()[k].push_back(j);
49 for (range_index i = 0; i < indices[0]; i++)
50 for (part_index j : simplex.partition()[i]) {
54 for (std::size_t l = 0; l < d; l++) value.vertex()[l]--;
55 value.partition()[k].push_back(j);
58 for (
auto& part : value.partition()) std::sort(part.begin(), part.end());
Ordered_set_partition_ OrderedSetPartition
Type of the ordered partition.
Definition: Permutahedral_representation.h:46