Coxeter_triangulation.h
1 /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2  * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3  * Author(s): Siargey Kachanovich
4  *
5  * Copyright (C) 2019 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 
11 #ifndef COXETER_TRIANGULATION_H_
12 #define COXETER_TRIANGULATION_H_
13 
14 #include <vector>
15 #include <cmath> // for std::sqrt
16 
17 #include <boost/range/iterator_range.hpp>
18 #include <boost/graph/graph_traits.hpp>
19 #include <boost/graph/adjacency_list.hpp>
20 
21 #include <Eigen/Eigenvalues>
22 #include <Eigen/Sparse>
23 #include <Eigen/SVD>
24 
25 #include <gudhi/Freudenthal_triangulation.h>
26 #include <gudhi/Permutahedral_representation.h>
27 
28 namespace Gudhi {
29 
30 namespace coxeter_triangulation {
31 
43 template <class Permutahedral_representation_ =
44  Permutahedral_representation<std::vector<int>, std::vector<std::vector<std::size_t> > > >
45 class Coxeter_triangulation : public Freudenthal_triangulation<Permutahedral_representation_> {
46  using Matrix = Eigen::MatrixXd;
47 
48  Matrix root_matrix(unsigned d) {
49  Matrix cartan(Matrix::Identity(d, d));
50  for (unsigned i = 1; i < d; i++) {
51  cartan(i - 1, i) = -0.5;
52  cartan(i, i - 1) = -0.5;
53  }
54  Eigen::SelfAdjointEigenSolver<Matrix> saes(cartan);
55  Eigen::VectorXd sqrt_diag(d);
56  for (unsigned i = 0; i < d; ++i) sqrt_diag(i) = std::sqrt(saes.eigenvalues()[i]);
57 
58  Matrix lower(Matrix::Ones(d, d));
59  lower = lower.triangularView<Eigen::Lower>();
60 
61  Matrix result = (lower * saes.eigenvectors() * sqrt_diag.asDiagonal()).inverse();
62  return result;
63  }
64 
65  public:
70  : Freudenthal_triangulation<Permutahedral_representation_>(dimension, root_matrix(dimension)) {}
71 };
72 
73 } // namespace coxeter_triangulation
74 
75 } // namespace Gudhi
76 
77 #endif
A class that stores Coxeter triangulation of type . This triangulation has the greatest simplex quali...
Definition: Coxeter_triangulation.h:45
Coxeter_triangulation(std::size_t dimension)
Constructor of Coxeter triangulation of a given dimension.
Definition: Coxeter_triangulation.h:69
A class that stores any affine transformation of the Freudenthal-Kuhn triangulation.
Definition: Freudenthal_triangulation.h:46
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14