Manicore
Library to implement schemes on n-dimensionnal manifolds.
exterior_dimension.hpp
Go to the documentation of this file.
1 #ifndef EXTERIOR_DIMENSION_HPP
2 #define EXTERIOR_DIMENSION_HPP
3 
12 #include <cstddef>
13 
16  constexpr size_t factorial(size_t n)
17  {
18  return (n < 2)? 1 : n*factorial(n-1);
19  }
20 
22  constexpr size_t binom(size_t n, size_t k)
23  {
24  return
25  ( k> n )? 0 : // out of range
26  (k==0 || k==n )? 1 : // edge
27  (k==1 || k==n-1)? n : // first
28  ( k+k < n )? // recursive:
29  (binom(n-1,k-1) * n)/k : // path to k=1 is faster
30  (binom(n-1,k) * n)/(n-k); // path to k=n-1 is faster
31  }
32 
35 
37  constexpr size_t ExtDim(size_t l,size_t d)
38  {
39  return binom(d,l);
40  }
41 
43  constexpr size_t PolyDim(int r,size_t d)
44  {
45  return (r >= 0) ? binom(r+d,d):0;
46  }
47 
49  constexpr size_t HDim(int r, size_t d)
50  {
51  return PolyDim(r,d) - PolyDim(r-1,d);
52  }
53 
55  constexpr size_t PLDim(int r, size_t l, size_t d)
56  {
57  return ExtDim(l,d)*PolyDim(r,d);
58  }
59 
61  constexpr size_t kHDim(int r, size_t l, size_t d)
62  {
63  return
64  (l > d) ? 0 :
65  (l == 0) ? 0 :
66  (r < 0) ? 0 :
67  binom(d+r,d-l)*binom(r+l-1,l-1);
68  }
70  constexpr size_t dHDim(int r, size_t l, size_t d)
71  {
72  return kHDim(r-1,l+1,d);
73  }
75  constexpr size_t kPLDim(int r, size_t l, size_t d)
76  {
77  size_t sum = 0;
78  for (int i = 0; i <= r; ++i) {
79  sum += kHDim(i,l,d);
80  }
81  return sum;
82  }
83 
85  constexpr size_t dPLDim(int r, size_t l, size_t d)
86  {
87  size_t sum = 0;
88  for (int i = 0; i <= r; ++i) {
89  sum += dHDim(i,l,d);
90  }
91  return sum;
92  }
93 
95  constexpr size_t PLtrimmedDim(int r, size_t l, size_t d)
96  {
97  return (l == 0)?
98  ((r >= 0)? kPLDim(r-1,l+1,d) + 1 : 0) // We must add P_0\Lambda^0
99  : kPLDim(r-1,l+1,d) + dPLDim(r,l-1,d);
100  }
101 
103 }
104 
105 #endif
106 
constexpr size_t PLtrimmedDim(int r, size_t l, size_t d)
Dimension of trimmed polynomial spaces .
Definition: exterior_dimension.hpp:95
constexpr size_t kHDim(int r, size_t l, size_t d)
Dimension of the image of Koszul on homogeneous polynomials .
Definition: exterior_dimension.hpp:61
constexpr size_t ExtDim(size_t l, size_t d)
Dimension of the exterior algebra .
Definition: exterior_dimension.hpp:37
constexpr size_t dHDim(int r, size_t l, size_t d)
Dimension of the image of d on homogeneous polynomials .
Definition: exterior_dimension.hpp:70
constexpr size_t PLDim(int r, size_t l, size_t d)
Dimension of .
Definition: exterior_dimension.hpp:55
constexpr size_t kPLDim(int r, size_t l, size_t d)
Dimension of the image of Koszul on polynomials .
Definition: exterior_dimension.hpp:75
constexpr size_t PolyDim(int r, size_t d)
Dimension of .
Definition: exterior_dimension.hpp:43
constexpr size_t dPLDim(int r, size_t l, size_t d)
Dimension of the image of d on polynomials .
Definition: exterior_dimension.hpp:85
constexpr size_t HDim(int r, size_t d)
Dimension of homogeneous polynomials .
Definition: exterior_dimension.hpp:49
Definition: exterior_dimension.hpp:14
constexpr size_t factorial(size_t n)
Definition: exterior_dimension.hpp:16
constexpr size_t binom(size_t n, size_t k)
Definition: exterior_dimension.hpp:22