MoreMeta.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_MOREMETA_H
12 #define EIGEN_MOREMETA_H
13 
14 // IWYU pragma: private
15 #include "../InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 namespace internal {
20 
21 template <typename... tt>
22 struct type_list {
23  constexpr static int count = sizeof...(tt);
24 };
25 
26 template <typename t, typename... tt>
27 struct type_list<t, tt...> {
28  constexpr static int count = sizeof...(tt) + 1;
29  typedef t first_type;
30 };
31 
32 template <typename T, T... nn>
33 struct numeric_list {
34  constexpr static std::size_t count = sizeof...(nn);
35 };
36 
37 template <typename T, T n, T... nn>
38 struct numeric_list<T, n, nn...> {
39  static constexpr std::size_t count = sizeof...(nn) + 1;
40  static constexpr T first_value = n;
41 };
42 
43 #ifndef EIGEN_PARSED_BY_DOXYGEN
44 /* numeric list constructors
45  *
46  * equivalencies:
47  * constructor result
48  * typename gen_numeric_list<int, 5>::type numeric_list<int, 0,1,2,3,4>
49  * typename gen_numeric_list_reversed<int, 5>::type numeric_list<int, 4,3,2,1,0>
50  * typename gen_numeric_list_swapped_pair<int, 5,1,2>::type numeric_list<int, 0,2,1,3,4>
51  * typename gen_numeric_list_repeated<int, 0, 5>::type numeric_list<int, 0,0,0,0,0>
52  */
53 
54 template <typename T, std::size_t n, T start = 0, T... ii>
55 struct gen_numeric_list : gen_numeric_list<T, n - 1, start, start + n - 1, ii...> {};
56 template <typename T, T start, T... ii>
57 struct gen_numeric_list<T, 0, start, ii...> {
58  typedef numeric_list<T, ii...> type;
59 };
60 
61 template <typename T, std::size_t n, T start = 0, T... ii>
62 struct gen_numeric_list_reversed : gen_numeric_list_reversed<T, n - 1, start, ii..., start + n - 1> {};
63 template <typename T, T start, T... ii>
64 struct gen_numeric_list_reversed<T, 0, start, ii...> {
65  typedef numeric_list<T, ii...> type;
66 };
67 
68 template <typename T, std::size_t n, T a, T b, T start = 0, T... ii>
70  : gen_numeric_list_swapped_pair<T, n - 1, a, b, start,
71  (start + n - 1) == a ? b : ((start + n - 1) == b ? a : (start + n - 1)), ii...> {};
72 template <typename T, T a, T b, T start, T... ii>
73 struct gen_numeric_list_swapped_pair<T, 0, a, b, start, ii...> {
74  typedef numeric_list<T, ii...> type;
75 };
76 
77 template <typename T, std::size_t n, T V, T... nn>
78 struct gen_numeric_list_repeated : gen_numeric_list_repeated<T, n - 1, V, V, nn...> {};
79 template <typename T, T V, T... nn>
80 struct gen_numeric_list_repeated<T, 0, V, nn...> {
81  typedef numeric_list<T, nn...> type;
82 };
83 
84 /* list manipulation: concatenate */
85 
86 template <class a, class b>
87 struct concat;
88 
89 template <typename... as, typename... bs>
90 struct concat<type_list<as...>, type_list<bs...>> {
91  typedef type_list<as..., bs...> type;
92 };
93 template <typename T, T... as, T... bs>
94 struct concat<numeric_list<T, as...>, numeric_list<T, bs...>> {
95  typedef numeric_list<T, as..., bs...> type;
96 };
97 
98 template <typename... p>
99 struct mconcat;
100 template <typename a>
101 struct mconcat<a> {
102  typedef a type;
103 };
104 template <typename a, typename b>
105 struct mconcat<a, b> : concat<a, b> {};
106 template <typename a, typename b, typename... cs>
107 struct mconcat<a, b, cs...> : concat<a, typename mconcat<b, cs...>::type> {};
108 
109 /* list manipulation: extract slices */
110 
111 template <int n, typename x>
112 struct take;
113 template <int n, typename a, typename... as>
114 struct take<n, type_list<a, as...>> : concat<type_list<a>, typename take<n - 1, type_list<as...>>::type> {};
115 template <int n>
116 struct take<n, type_list<>> {
117  typedef type_list<> type;
118 };
119 template <typename a, typename... as>
120 struct take<0, type_list<a, as...>> {
121  typedef type_list<> type;
122 };
123 template <>
124 struct take<0, type_list<>> {
125  typedef type_list<> type;
126 };
127 
128 template <typename T, int n, T a, T... as>
129 struct take<n, numeric_list<T, a, as...>>
130  : concat<numeric_list<T, a>, typename take<n - 1, numeric_list<T, as...>>::type> {};
131 // XXX The following breaks in gcc-11, and is invalid anyways.
132 // template<typename T, int n> struct take<n, numeric_list<T>> { typedef numeric_list<T> type;
133 // };
134 template <typename T, T a, T... as>
135 struct take<0, numeric_list<T, a, as...>> {
137 };
138 template <typename T>
139 struct take<0, numeric_list<T>> {
141 };
142 
143 template <typename T, int n, T... ii>
145 template <typename T, int n, T i, T... ii>
146 struct h_skip_helper_numeric<T, n, i, ii...> : h_skip_helper_numeric<T, n - 1, ii...> {};
147 template <typename T, T i, T... ii>
148 struct h_skip_helper_numeric<T, 0, i, ii...> {
149  typedef numeric_list<T, i, ii...> type;
150 };
151 template <typename T, int n>
154 };
155 template <typename T>
158 };
159 
160 template <int n, typename... tt>
162 template <int n, typename t, typename... tt>
163 struct h_skip_helper_type<n, t, tt...> : h_skip_helper_type<n - 1, tt...> {};
164 template <typename t, typename... tt>
165 struct h_skip_helper_type<0, t, tt...> {
166  typedef type_list<t, tt...> type;
167 };
168 template <int n>
170  typedef type_list<> type;
171 };
172 template <>
174  typedef type_list<> type;
175 };
176 #endif // not EIGEN_PARSED_BY_DOXYGEN
177 
178 template <int n>
179 struct h_skip {
180  template <typename T, T... ii>
181  constexpr static EIGEN_STRONG_INLINE typename h_skip_helper_numeric<T, n, ii...>::type helper(
184  }
185  template <typename... tt>
187  return typename h_skip_helper_type<n, tt...>::type();
188  }
189 };
190 
191 template <int n, typename a>
192 struct skip {
193  typedef decltype(h_skip<n>::helper(a())) type;
194 };
195 
196 template <int start, int count, typename a>
197 struct slice : take<count, typename skip<start, a>::type> {};
198 
199 /* list manipulation: retrieve single element from list */
200 
201 template <int n, typename x>
202 struct get;
203 
204 template <int n, typename a, typename... as>
205 struct get<n, type_list<a, as...>> : get<n - 1, type_list<as...>> {};
206 template <typename a, typename... as>
207 struct get<0, type_list<a, as...>> {
208  typedef a type;
209 };
210 
211 template <typename T, int n, T a, T... as>
212 struct get<n, numeric_list<T, a, as...>> : get<n - 1, numeric_list<T, as...>> {};
213 template <typename T, T a, T... as>
214 struct get<0, numeric_list<T, a, as...>> {
215  constexpr static T value = a;
216 };
217 
218 template <std::size_t n, typename T, T a, T... as>
221 }
222 
223 /* always get type, regardless of dummy; good for parameter pack expansion */
224 
225 template <typename T, T dummy, typename t>
226 struct id_numeric {
227  typedef t type;
228 };
229 template <typename dummy, typename t>
230 struct id_type {
231  typedef t type;
232 };
233 
234 /* equality checking, flagged version */
235 
236 template <typename a, typename b>
237 struct is_same_gf : is_same<a, b> {
238  constexpr static int global_flags = 0;
239 };
240 
241 /* apply_op to list */
242 
243 template <bool from_left, // false
244  template <typename, typename> class op, typename additional_param, typename... values>
247 };
248 template <template <typename, typename> class op, typename additional_param, typename... values>
249 struct h_apply_op_helper<true, op, additional_param, values...> {
251 };
252 
253 template <bool from_left, template <typename, typename> class op, typename additional_param>
254 struct h_apply_op {
255  template <typename... values>
256  constexpr static typename h_apply_op_helper<from_left, op, additional_param, values...>::type helper(
259  }
260 };
261 
262 template <template <typename, typename> class op, typename additional_param, typename a>
265 };
266 
267 template <template <typename, typename> class op, typename additional_param, typename a>
270 };
271 
272 /* see if an element is in a list */
273 
274 template <template <typename, typename> class test, typename check_against, typename h_list,
275  bool last_check_positive = false>
277 
278 template <template <typename, typename> class test, typename check_against, typename h_list>
279 struct contained_in_list<test, check_against, h_list, true> {
280  constexpr static bool value = true;
281 };
282 
283 template <template <typename, typename> class test, typename check_against, typename a, typename... as>
284 struct contained_in_list<test, check_against, type_list<a, as...>, false>
285  : contained_in_list<test, check_against, type_list<as...>, test<check_against, a>::value> {};
286 
287 template <template <typename, typename> class test, typename check_against, typename... empty>
288 struct contained_in_list<test, check_against, type_list<empty...>, false> {
289  constexpr static bool value = false;
290 };
291 
292 /* see if an element is in a list and check for global flags */
293 
294 template <template <typename, typename> class test, typename check_against, typename h_list, int default_flags = 0,
295  bool last_check_positive = false, int last_check_flags = default_flags>
297 
298 template <template <typename, typename> class test, typename check_against, typename h_list, int default_flags,
299  int last_check_flags>
300 struct contained_in_list_gf<test, check_against, h_list, default_flags, true, last_check_flags> {
301  constexpr static bool value = true;
302  constexpr static int global_flags = last_check_flags;
303 };
304 
305 template <template <typename, typename> class test, typename check_against, typename a, typename... as,
306  int default_flags, int last_check_flags>
307 struct contained_in_list_gf<test, check_against, type_list<a, as...>, default_flags, false, last_check_flags>
308  : contained_in_list_gf<test, check_against, type_list<as...>, default_flags, test<check_against, a>::value,
309  test<check_against, a>::global_flags> {};
310 
311 template <template <typename, typename> class test, typename check_against, typename... empty, int default_flags,
312  int last_check_flags>
313 struct contained_in_list_gf<test, check_against, type_list<empty...>, default_flags, false, last_check_flags> {
314  constexpr static bool value = false;
315  constexpr static int global_flags = default_flags;
316 };
317 
318 /* generic reductions */
319 
320 template <typename Reducer, typename... Ts>
321 struct reduce;
322 
323 template <typename Reducer>
324 struct reduce<Reducer> {
325  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE int run() { return Reducer::Identity; }
326 };
327 
328 template <typename Reducer, typename A>
329 struct reduce<Reducer, A> {
330  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE A run(A a) { return a; }
331 };
332 
333 template <typename Reducer, typename A, typename... Ts>
334 struct reduce<Reducer, A, Ts...> {
335  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, Ts... ts)
336  -> decltype(Reducer::run(a, reduce<Reducer, Ts...>::run(ts...))) {
338  }
339 };
340 
341 /* generic binary operations */
342 
343 struct sum_op {
344  template <typename A, typename B>
345  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a + b) {
346  return a + b;
347  }
348  static constexpr int Identity = 0;
349 };
350 struct product_op {
351  template <typename A, typename B>
352  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a * b) {
353  return a * b;
354  }
355  static constexpr int Identity = 1;
356 };
357 
359  template <typename A, typename B>
360  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a && b) {
361  return a && b;
362  }
363 };
365  template <typename A, typename B>
366  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a || b) {
367  return a || b;
368  }
369 };
370 
371 struct equal_op {
372  template <typename A, typename B>
373  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a == b) {
374  return a == b;
375  }
376 };
377 struct not_equal_op {
378  template <typename A, typename B>
379  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a != b) {
380  return a != b;
381  }
382 };
383 struct lesser_op {
384  template <typename A, typename B>
385  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a < b) {
386  return a < b;
387  }
388 };
390  template <typename A, typename B>
391  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a <= b) {
392  return a <= b;
393  }
394 };
395 struct greater_op {
396  template <typename A, typename B>
397  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a > b) {
398  return a > b;
399  }
400 };
402  template <typename A, typename B>
403  constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a >= b) {
404  return a >= b;
405  }
406 };
407 
408 /* generic unary operations */
409 
410 struct not_op {
411  template <typename A>
412  constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(!a) {
413  return !a;
414  }
415 };
416 struct negation_op {
417  template <typename A>
418  constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(-a) {
419  return -a;
420  }
421 };
423  template <typename A>
424  constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(a >= 0) {
425  return a >= 0;
426  }
427 };
428 
429 /* reductions for lists */
430 
431 // using auto -> return value spec makes ICC 13.0 and 13.1 crash here, so we have to hack it
432 // together in front... (13.0 doesn't work with array_prod/array_reduce/... anyway, but 13.1
433 // does...
434 template <typename... Ts>
436  Ts... ts) {
437  return reduce<product_op, Ts...>::run(ts...);
438 }
439 
440 template <typename... Ts>
441 constexpr EIGEN_STRONG_INLINE decltype(reduce<sum_op, Ts...>::run((*((Ts*)0))...)) arg_sum(Ts... ts) {
442  return reduce<sum_op, Ts...>::run(ts...);
443 }
444 
445 /* reverse arrays */
446 
447 template <typename Array, int... n>
449  return {{array_get<sizeof...(n) - n - 1>(arr)...}};
450 }
451 
452 template <typename T, std::size_t N>
454  return h_array_reverse(arr, typename gen_numeric_list<int, N>::type());
455 }
456 
457 /* generic array reductions */
458 
459 // can't reuse standard reduce() interface above because Intel's Compiler
460 // *really* doesn't like it, so we just reimplement the stuff
461 // (start from N - 1 and work down to 0 because specialization for
462 // n == N - 1 also doesn't work in Intel's compiler, so it goes into
463 // an infinite loop)
464 template <typename Reducer, typename T, std::size_t N, std::size_t n = N - 1>
466  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(array<T, N> arr, T identity)
467  -> decltype(Reducer::run(h_array_reduce<Reducer, T, N, n - 1>::run(arr, identity), array_get<n>(arr))) {
468  return Reducer::run(h_array_reduce<Reducer, T, N, n - 1>::run(arr, identity), array_get<n>(arr));
469  }
470 };
471 
472 template <typename Reducer, typename T, std::size_t N>
473 struct h_array_reduce<Reducer, T, N, 0> {
474  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE T run(const array<T, N>& arr, T) { return array_get<0>(arr); }
475 };
476 
477 template <typename Reducer, typename T>
478 struct h_array_reduce<Reducer, T, 0> {
479  EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE T run(const array<T, 0>&, T identity) { return identity; }
480 };
481 
482 template <typename Reducer, typename T, std::size_t N>
483 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_reduce(const array<T, N>& arr, T identity)
484  -> decltype(h_array_reduce<Reducer, T, N>::run(arr, identity)) {
485  return h_array_reduce<Reducer, T, N>::run(arr, identity);
486 }
487 
488 /* standard array reductions */
489 
490 template <typename T, std::size_t N>
492  -> decltype(array_reduce<sum_op, T, N>(arr, static_cast<T>(0))) {
493  return array_reduce<sum_op, T, N>(arr, static_cast<T>(0));
494 }
495 
496 template <typename T, std::size_t N>
498  -> decltype(array_reduce<product_op, T, N>(arr, static_cast<T>(1))) {
499  return array_reduce<product_op, T, N>(arr, static_cast<T>(1));
500 }
501 
502 template <typename t>
504  eigen_assert(a.size() > 0);
505  t prod = 1;
506  for (size_t i = 0; i < a.size(); ++i) {
507  prod *= a[i];
508  }
509  return prod;
510 }
511 
512 /* zip an array */
513 
514 template <typename Op, typename A, typename B, std::size_t N, int... n>
517  return array<decltype(Op::run(A(), B())), N>{{Op::run(array_get<n>(a), array_get<n>(b))...}};
518 }
519 
520 template <typename Op, typename A, typename B, std::size_t N>
522  return h_array_zip<Op>(a, b, typename gen_numeric_list<int, N>::type());
523 }
524 
525 /* zip an array and reduce the result */
526 
527 template <typename Reducer, typename Op, typename A, typename B, std::size_t N, int... n>
529  -> decltype(reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A(), B()))>::type...>::run(
530  Op::run(array_get<n>(a), array_get<n>(b))...)) {
531  return reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A(), B()))>::type...>::run(
532  Op::run(array_get<n>(a), array_get<n>(b))...);
533 }
534 
535 template <typename Reducer, typename Op, typename A, typename B, std::size_t N>
537  -> decltype(h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type())) {
538  return h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type());
539 }
540 
541 /* apply stuff to an array */
542 
543 template <typename Op, typename A, std::size_t N, int... n>
545  return array<decltype(Op::run(A())), N>{{Op::run(array_get<n>(a))...}};
546 }
547 
548 template <typename Op, typename A, std::size_t N>
550  return h_array_apply<Op>(a, typename gen_numeric_list<int, N>::type());
551 }
552 
553 /* apply stuff to an array and reduce */
554 
555 template <typename Reducer, typename Op, typename A, std::size_t N, int... n>
557  -> decltype(reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A()))>::type...>::run(
558  Op::run(array_get<n>(arr))...)) {
559  return reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A()))>::type...>::run(
560  Op::run(array_get<n>(arr))...);
561 }
562 
563 template <typename Reducer, typename Op, typename A, std::size_t N>
565  -> decltype(h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type())) {
566  return h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type());
567 }
568 
569 /* repeat a value n times (and make an array out of it
570  * usage:
571  * array<int, 16> = repeat<16>(42);
572  */
573 
574 template <int n>
575 struct h_repeat {
576  template <typename t, int... ii>
578  return {{typename id_numeric<int, ii, t>::type(v)...}};
579  }
580 };
581 
582 template <int n, typename t>
583 constexpr array<t, n> repeat(t v) {
585 }
586 
587 /* instantiate a class by a C-style array */
588 template <class InstType, typename ArrType, std::size_t N, bool Reverse, typename... Ps>
590 
591 template <class InstType, typename ArrType, std::size_t N, typename... Ps>
592 struct h_instantiate_by_c_array<InstType, ArrType, N, false, Ps...> {
593  static InstType run(ArrType* arr, Ps... args) {
595  }
596 };
597 
598 template <class InstType, typename ArrType, std::size_t N, typename... Ps>
599 struct h_instantiate_by_c_array<InstType, ArrType, N, true, Ps...> {
600  static InstType run(ArrType* arr, Ps... args) {
602  }
603 };
604 
605 template <class InstType, typename ArrType, typename... Ps>
606 struct h_instantiate_by_c_array<InstType, ArrType, 0, false, Ps...> {
607  static InstType run(ArrType* arr, Ps... args) {
608  (void)arr;
609  return InstType(args...);
610  }
611 };
612 
613 template <class InstType, typename ArrType, typename... Ps>
614 struct h_instantiate_by_c_array<InstType, ArrType, 0, true, Ps...> {
615  static InstType run(ArrType* arr, Ps... args) {
616  (void)arr;
617  return InstType(args...);
618  }
619 };
620 
621 template <class InstType, typename ArrType, std::size_t N, bool Reverse = false>
622 InstType instantiate_by_c_array(ArrType* arr) {
624 }
625 
626 } // end namespace internal
627 
628 } // end namespace Eigen
629 
630 #endif // EIGEN_MOREMETA_H
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
MatrixXcd V
Definition: EigenSolver_EigenSolver_MatrixType.cpp:15
Eigen::Triplet< double > T
Definition: EigenUnitTest.cpp:11
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
float * p
Definition: Tutorial_Map_using.cpp:9
Scalar * b
Definition: benchVecAdd.cpp:17
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:48
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:48
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:65
Definition: matrices.h:74
@ N
Definition: constructor.cpp:22
return int(ret)+1
const Scalar * a
Definition: level2_cplx_impl.h:32
char char * op
Definition: level2_impl.h:374
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto array_reduce(const array< T, N > &arr, T identity) -> decltype(h_array_reduce< Reducer, T, N >::run(arr, identity))
Definition: MoreMeta.h:483
constexpr EIGEN_STRONG_INLINE array< decltype(Op::run(A())), N > h_array_apply(array< A, N > a, numeric_list< int, n... >)
Definition: MoreMeta.h:544
constexpr EIGEN_DEVICE_FUNCdecltype(reduce< product_op, Ts... >::run((*((Ts *) 0))...)) EIGEN_STRONG_INLIN arg_prod)(Ts... ts)
Definition: MoreMeta.h:435
constexpr EIGEN_STRONG_INLINE auto h_array_apply_and_reduce(array< A, N > arr, numeric_list< int, n... >) -> decltype(reduce< Reducer, typename id_numeric< int, n, decltype(Op::run(A()))>::type... >::run(Op::run(array_get< n >(arr))...))
Definition: MoreMeta.h:556
constexpr EIGEN_STRONG_INLINE array< decltype(Op::run(A(), B())), N > h_array_zip(array< A, N > a, array< B, N > b, numeric_list< int, n... >)
Definition: MoreMeta.h:515
constexpr EIGEN_STRONG_INLINE Array h_array_reverse(Array arr, numeric_list< int, n... >)
Definition: MoreMeta.h:448
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto array_prod(const array< T, N > &arr) -> decltype(array_reduce< product_op, T, N >(arr, static_cast< T >(1)))
Definition: MoreMeta.h:497
constexpr EIGEN_STRONG_INLINE array< decltype(Op::run(A())), N > array_apply(array< A, N > a)
Definition: MoreMeta.h:549
constexpr EIGEN_STRONG_INLINE auto h_array_zip_and_reduce(array< A, N > a, array< B, N > b, numeric_list< int, n... >) -> decltype(reduce< Reducer, typename id_numeric< int, n, decltype(Op::run(A(), B()))>::type... >::run(Op::run(array_get< n >(a), array_get< n >(b))...))
Definition: MoreMeta.h:528
constexpr T & array_get(std::array< T, N > &a)
Definition: EmulateArray.h:251
constexpr EIGEN_STRONG_INLINE array< T, N > array_reverse(array< T, N > arr)
Definition: MoreMeta.h:453
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto array_sum(const array< T, N > &arr) -> decltype(array_reduce< sum_op, T, N >(arr, static_cast< T >(0)))
Definition: MoreMeta.h:491
constexpr array< t, n > repeat(t v)
Definition: MoreMeta.h:583
constexpr EIGEN_STRONG_INLINE auto array_zip_and_reduce(array< A, N > a, array< B, N > b) -> decltype(h_array_zip_and_reduce< Reducer, Op, A, B, N >(a, b, typename gen_numeric_list< int, N >::type()))
Definition: MoreMeta.h:536
constexpr decltype(reduce< sum_op, Ts... >::run((*((Ts *) 0))...)) EIGEN_STRONG_INLIN arg_sum)(Ts... ts)
Definition: MoreMeta.h:441
InstType instantiate_by_c_array(ArrType *arr)
Definition: MoreMeta.h:622
constexpr EIGEN_STRONG_INLINE auto array_apply_and_reduce(array< A, N > a) -> decltype(h_array_apply_and_reduce< Reducer, Op, A, N >(a, typename gen_numeric_list< int, N >::type()))
Definition: MoreMeta.h:564
constexpr EIGEN_STRONG_INLINE array< decltype(Op::run(A(), B())), N > array_zip(array< A, N > a, array< B, N > b)
Definition: MoreMeta.h:521
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
std::array< T, N > array
Definition: EmulateArray.h:231
squared absolute value
Definition: GlobalFunctions.h:87
squared absolute sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2 sa Eigen::abs2 DOXCOMMA Eigen::pow DOXCOMMA ArrayBase::square nearest sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round nearest integer not less than the given sa Eigen::floor DOXCOMMA ArrayBase::ceil not a number test
Definition: GlobalFunctions.h:109
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)
Definition: evaluators.cpp:7
args
Definition: compute_granudrum_aor.py:143
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
void start(const unsigned &i)
(Re-)start i-th timer
Definition: oomph_utilities.cc:243
t
Definition: plotPSD.py:36
Definition: indexed_view.cpp:20
Definition: MoreMeta.h:263
Definition: MoreMeta.h:268
numeric_list< T, as..., bs... > type
Definition: MoreMeta.h:95
type_list< as..., bs... > type
Definition: MoreMeta.h:91
Definition: MoreMeta.h:87
Definition: MoreMeta.h:296
Definition: MoreMeta.h:276
Definition: MoreMeta.h:371
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a==b)
Definition: MoreMeta.h:373
numeric_list< T, ii... > type
Definition: MoreMeta.h:58
numeric_list< T, nn... > type
Definition: MoreMeta.h:81
numeric_list< T, ii... > type
Definition: MoreMeta.h:65
numeric_list< T, ii... > type
Definition: MoreMeta.h:74
Definition: MoreMeta.h:55
Definition: MoreMeta.h:202
Definition: MoreMeta.h:401
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a >=b)
Definition: MoreMeta.h:403
Definition: MoreMeta.h:422
constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(a >=0)
Definition: MoreMeta.h:424
Definition: MoreMeta.h:395
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a > b)
Definition: MoreMeta.h:397
type_list< typename op< additional_param, values >::type... > type
Definition: MoreMeta.h:250
Definition: MoreMeta.h:245
type_list< typename op< values, additional_param >::type... > type
Definition: MoreMeta.h:246
Definition: MoreMeta.h:254
constexpr static h_apply_op_helper< from_left, op, additional_param, values... >::type helper(type_list< values... >)
Definition: MoreMeta.h:256
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T run(const array< T, 0 > &, T identity)
Definition: MoreMeta.h:479
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T run(const array< T, N > &arr, T)
Definition: MoreMeta.h:474
Definition: MoreMeta.h:465
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto run(array< T, N > arr, T identity) -> decltype(Reducer::run(h_array_reduce< Reducer, T, N, n - 1 >::run(arr, identity), array_get< n >(arr)))
Definition: MoreMeta.h:466
static InstType run(ArrType *arr, Ps... args)
Definition: MoreMeta.h:607
static InstType run(ArrType *arr, Ps... args)
Definition: MoreMeta.h:615
static InstType run(ArrType *arr, Ps... args)
Definition: MoreMeta.h:593
static InstType run(ArrType *arr, Ps... args)
Definition: MoreMeta.h:600
Definition: MoreMeta.h:575
constexpr static EIGEN_STRONG_INLINE array< t, n > run(t v, numeric_list< int, ii... >)
Definition: MoreMeta.h:577
numeric_list< T, i, ii... > type
Definition: MoreMeta.h:149
numeric_list< T > type
Definition: MoreMeta.h:157
numeric_list< T > type
Definition: MoreMeta.h:153
Definition: MoreMeta.h:144
type_list< t, tt... > type
Definition: MoreMeta.h:166
type_list type
Definition: MoreMeta.h:174
type_list type
Definition: MoreMeta.h:170
Definition: MoreMeta.h:161
Definition: MoreMeta.h:179
constexpr static EIGEN_STRONG_INLINE h_skip_helper_type< n, tt... >::type helper(type_list< tt... >)
Definition: MoreMeta.h:186
constexpr static EIGEN_STRONG_INLINE h_skip_helper_numeric< T, n, ii... >::type helper(numeric_list< T, ii... >)
Definition: MoreMeta.h:181
Definition: MoreMeta.h:226
t type
Definition: MoreMeta.h:227
Definition: MoreMeta.h:230
t type
Definition: MoreMeta.h:231
Definition: MoreMeta.h:237
Definition: Meta.h:205
Definition: MoreMeta.h:389
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a<=b)
Definition: MoreMeta.h:391
Definition: MoreMeta.h:383
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a< b)
Definition: MoreMeta.h:385
Definition: MoreMeta.h:358
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a &&b)
Definition: MoreMeta.h:360
Definition: MoreMeta.h:364
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a||b)
Definition: MoreMeta.h:366
a type
Definition: MoreMeta.h:102
Definition: MoreMeta.h:99
Definition: MoreMeta.h:416
constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(-a)
Definition: MoreMeta.h:418
Definition: MoreMeta.h:377
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a !=b)
Definition: MoreMeta.h:379
Definition: MoreMeta.h:410
constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(!a)
Definition: MoreMeta.h:412
Definition: MoreMeta.h:33
constexpr static std::size_t count
Definition: MoreMeta.h:34
Definition: MoreMeta.h:350
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a *b)
Definition: MoreMeta.h:352
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto run(A a, Ts... ts) -> decltype(Reducer::run(a, reduce< Reducer, Ts... >::run(ts...)))
Definition: MoreMeta.h:335
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE A run(A a)
Definition: MoreMeta.h:330
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int run()
Definition: MoreMeta.h:325
Definition: MoreMeta.h:321
Definition: MoreMeta.h:192
decltype(h_skip< n >::helper(a())) typedef type
Definition: MoreMeta.h:193
Definition: MoreMeta.h:197
Definition: MoreMeta.h:343
constexpr static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a+b)
Definition: MoreMeta.h:345
numeric_list< T > type
Definition: MoreMeta.h:136
numeric_list< T > type
Definition: MoreMeta.h:140
type_list type
Definition: MoreMeta.h:121
type_list type
Definition: MoreMeta.h:125
type_list type
Definition: MoreMeta.h:117
Definition: MoreMeta.h:112
t first_type
Definition: MoreMeta.h:29
Definition: MoreMeta.h:22
constexpr static int count
Definition: MoreMeta.h:23
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317