158 m_Max(Max < N ? Max : N),
159 workA(N + 1, Length),
160 workB(N + 1, Length) {
161
162
163 if(Length <= 1) {
165 return;
166 }
167
168 int max = std::min(Max, N);
170 for(int l = 0; l < Length; ++l) Dims(0, l) = 1;
171 for(
int n = N; n >
max; --n) {
172 Dims(n, 1) = 0;
173 Dims(n, 0) = 0;
175 }
176 for(
int n =
max; n >= 0; --n) {
177 Dims(n, 1) = 1;
178 Dims(n, 0) = 0;
180 }
181
182 for(int l = 2; l < Length; ++l)
183 for(int n = 1; n <= N; ++n) {
184 Dims(n, l) = 0;
185 for(
int k = 0; k <= std::min(
max, n); ++k) { Dims(n, l) += Dims(n - k, l - 1); }
186 }
187
188
189 for(int l = 1; l < Length; ++l) {
190 workA(0, l) = Dims(N, Length - l);
191 for(
int n = 1; n <= N; ++n)
workA(n, l) =
workA(n - 1, l) + Dims(N - n, Length - l);
192 }
193
194
195 for(
int l = 0; l < Length; ++l)
workB(0, l) = 0;
196 for(int n = 1; n <= N; ++n) {
197 for(
int l = 1; l < Length - 1; ++l)
workB(n, l) =
workA(n - 1, l) -
workA(n - 1, l + 1);
198 workB(n, Length - 1) =
workA(n - 1, Length - 1);
199 }
200
201
203
204 debug_printf("(END) IntegerComposition::IntegerComposition(%d,%d,%d) : Dim = %d\n", (int)N,
205 (
int)Length, (
int)Max, (
int)
m_dim);
206}
int m_Length
Definition IntegerComposition.hpp:61
int m_N
Definition IntegerComposition.hpp:60
Eigen::MatrixX< Index_t > workB
Definition IntegerComposition.hpp:65
__host__ __device__ int max() const
Definition IntegerComposition.hpp:89
int m_Max
Definition IntegerComposition.hpp:62
Eigen::MatrixX< Index_t > workA
Definition IntegerComposition.hpp:64
Index_t m_dim
Definition IntegerComposition.hpp:63