27 template <
typename... T>
35 template <
typename T0>
46 template <
typename T0,
typename T1>
59 template <
typename T0,
typename T1,
typename T2>
74 template <
typename T0,
typename T1,
typename T2,
typename T3>
91 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
92 struct tuple<T0, T1, T2, T3, T4> {
110 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
111 struct tuple<T0, T1, T2, T3, T4, T5> {
131 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
132 struct tuple<T0, T1, T2, T3, T4, T5, T6> {
154 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
155 struct tuple<T0, T1, T2, T3, T4, T5, T6, T7> {
179 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
181 struct tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> {
207 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
208 typename T8,
typename T9>
209 struct tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> {
237 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
238 typename T8,
typename T9,
typename T10>
239 struct tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> {
257 template <
typename... T>
265 template <
typename... T>
268 return tuple<T...>{args...};
271 template <
class... Types>
274 template <
class... Types>
282 template <
int i,
typename... T>
285 static_assert(i <
sizeof...(T),
"");
286 if constexpr (i == 0) {
289 if constexpr (i == 1) {
292 if constexpr (i == 2) {
295 if constexpr (i == 3) {
298 if constexpr (i == 4) {
301 if constexpr (i == 5) {
304 if constexpr (i == 6) {
307 if constexpr (i == 7) {
310 if constexpr (i == 8) {
313 if constexpr (i == 9) {
316 if constexpr (i == 10) {
326 template <
int i,
typename... T>
329 static_assert(i <
sizeof...(T),
"");
330 if constexpr (i == 0) {
333 if constexpr (i == 1) {
336 if constexpr (i == 2) {
339 if constexpr (i == 3) {
342 if constexpr (i == 4) {
345 if constexpr (i == 5) {
348 if constexpr (i == 6) {
351 if constexpr (i == 7) {
354 if constexpr (i == 8) {
357 if constexpr (i == 9) {
360 if constexpr (i == 10) {
375 template <
int i,
typename... T>
378 static_assert(i <
sizeof...(T),
"");
379 if constexpr (i == 0) {
382 if constexpr (i == 1) {
385 if constexpr (i == 2) {
388 if constexpr (i == 3) {
391 if constexpr (i == 4) {
394 if constexpr (i == 5) {
397 if constexpr (i == 6) {
400 if constexpr (i == 7) {
403 if constexpr (i == 8) {
406 if constexpr (i == 9) {
409 if constexpr (i == 10) {
424 template <
typename... S,
typename... T,
int... i>
426 std::integer_sequence<int, i...>)
428 return tuple{get<i>(x) + get<i>(y)...};
438 template <
typename... S,
typename... T>
441 static_assert(
sizeof...(S) ==
sizeof...(T));
442 return plus_helper(x, y, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(S))>());
453 template <
typename... T,
int... i>
455 std::integer_sequence<int, i...>)
457 ((get<i>(x) += get<i>(y)), ...);
466 template <
typename... T>
469 return plus_equals_helper(x, y, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
480 template <
typename... T,
int... i>
482 std::integer_sequence<int, i...>)
484 ((get<i>(x) -= get<i>(y)), ...);
493 template <
typename... T>
496 return minus_equals_helper(x, y, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
509 template <
typename... S,
typename... T,
int... i>
511 std::integer_sequence<int, i...>)
513 return tuple{get<i>(x) - get<i>(y)...};
523 template <
typename... S,
typename... T>
526 static_assert(
sizeof...(S) ==
sizeof...(T));
527 return minus_helper(x, y, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(S))>());
538 template <
typename... T,
int... i>
541 return tuple{-get<i>(x)...};
549 template <
typename... T>
552 return unary_minus_helper(x, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
565 template <
typename... S,
typename... T,
int... i>
567 std::integer_sequence<int, i...>)
569 return tuple{get<i>(x) / get<i>(y)...};
579 template <
typename... S,
typename... T>
582 static_assert(
sizeof...(S) ==
sizeof...(T));
583 return div_helper(x, y, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(S))>());
595 template <
typename... T,
int... i>
598 return tuple{a / get<i>(x)...};
610 template <
typename... T,
int... i>
613 return tuple{get<i>(x) / a...};
622 template <
typename... T>
625 return div_helper(a, x, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
634 template <
typename... T>
637 return div_helper(x, a, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
650 template <
typename... S,
typename... T,
int... i>
652 std::integer_sequence<int, i...>)
654 return tuple{get<i>(x) * get<i>(y)...};
664 template <
typename... S,
typename... T>
667 static_assert(
sizeof...(S) ==
sizeof...(T));
668 return mult_helper(x, y, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(S))>());
680 template <
typename... T,
int... i>
683 return tuple{a * get<i>(x)...};
695 template <
typename... T,
int... i>
698 return tuple{get<i>(x) * a...};
707 template <
typename... T>
710 return mult_helper(a, x, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
719 template <
typename... T>
722 return mult_helper(x, a, std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
732 template <
typename... T, std::size_t... i>
736 (..., (out << (i == 0 ?
"" :
", ") << smith::get<i>(A)));
747 template <
typename... T>
750 return print_helper(out, A, std::make_integer_sequence<
size_t,
sizeof...(T)>());
763 template <
typename lambda,
typename... T,
int... i>
766 return f(get<i>(args)...);
778 template <
typename lambda,
typename... T>
781 return apply_helper(f, std::move(args), std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
787 template <
typename lambda,
typename... T,
int... i>
790 return f(get<i>(args)...);
802 template <
typename lambda,
typename... T>
805 return apply_helper(f, std::move(args), std::make_integer_sequence<
int,
static_cast<int>(
sizeof...(T))>());
816 template <
size_t I,
class T>
821 template <
size_t I,
class Head,
class... Tail>
826 template <
class Head,
class... Tail>
834 template <
typename T>
838 template <
typename... T>
844 template <
typename T>
850 template <
typename... T>
857 #include "smith/numerics/functional/tuple_tensor_dual_functions.hpp"
This file contains the interface used for initializing/terminating any hardware accelerator-related f...
#define SMITH_HOST_DEVICE
Macro that evaluates to __host__ __device__ when compiling with nvcc or amdclang and does nothing on ...
Accelerator functionality.
constexpr SMITH_HOST_DEVICE void plus_equals_helper(tuple< T... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
A helper function for the += operator of tuples.
tuple(T...) -> tuple< T... >
Class template argument deduction rule for tuples.
constexpr SMITH_HOST_DEVICE auto & operator+=(dual< gradient_type > &a, const dual< gradient_type > &b)
compound assignment (+) for dual numbers
SMITH_HOST_DEVICE auto apply(lambda f, tuple< T... > &args)
a way of passing an n-tuple to a function that expects n separate arguments
constexpr T & get(variant< T0, T1 > &v)
Returns the variant member of specified type.
constexpr SMITH_HOST_DEVICE auto minus_helper(const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
A helper function for the - operator of tuples.
FieldStateWeightedSum operator+(const FieldState &x, const FieldState &y)
add two FieldState
constexpr SMITH_HOST_DEVICE auto unary_minus_helper(const tuple< T... > &x, std::integer_sequence< int, i... >)
A helper function for the - operator of tuples.
SMITH_HOST_DEVICE auto apply_helper(lambda f, tuple< T... > &args, std::integer_sequence< int, i... >)
A helper to apply a lambda to a tuple.
std::ostream & operator<<(std::ostream &out, DoF dof)
stream output for DoF
constexpr SMITH_HOST_DEVICE auto type(const tuple< T... > &values)
a function intended to be used for extracting the ith type from a tuple.
constexpr SMITH_HOST_DEVICE auto mult_helper(const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
A helper function for the * operator of tuples.
constexpr SMITH_HOST_DEVICE auto div_helper(const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
A helper function for the / operator of tuples.
constexpr SMITH_HOST_DEVICE auto plus_helper(const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
A helper function for the + operator of tuples.
constexpr SMITH_HOST_DEVICE void minus_equals_helper(tuple< T... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
A helper function for the -= operator of tuples.
SMITH_HOST_DEVICE tuple< T... > make_tuple(const T &... args)
helper function for combining a list of values into a tuple
auto & print_helper(std::ostream &out, const smith::tuple< T... > &A, std::integer_sequence< size_t, i... >)
helper used to implement printing a tuple of values
FieldStateWeightedSum operator*(double a, const FieldState &b)
multiply scalar by a FieldState to get a temporary FieldStateWeightedSum which can cast back to a Fie...
constexpr SMITH_HOST_DEVICE auto & operator-=(dual< gradient_type > &a, const dual< gradient_type > &b)
compound assignment (-) for dual numbers
FieldStateWeightedSum operator-(const FieldState &x, const FieldState &y)
subtract two FieldState
constexpr SMITH_HOST_DEVICE auto operator/(const dual< gradient_type > &a, double b)
division of a dual number by a non-dual number
Trait for checking if a type if a smith::tuple containing only smith::tuple.
Trait for checking if a type is a smith::tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v8 T8 v8
The ninth member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v9 T9 v9
The tenth member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v3 T3 v3
The fourth member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v5 T5 v5
The sixth member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v2 T2 v2
The third member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v7 T7 v7
The eighth member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v1 T1 v1
The second member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v6 T6 v6
The seventh member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v0 T0 v0
The first member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v10 T10 v10
The eleventh member of the tuple.
smith::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >::v4 T4 v4
The fifth member of the tuple.
T7 v7
The eighth member of the tuple.
T0 v0
The first member of the tuple.
T5 v5
The sixth member of the tuple.
T9 v9
The tenth member of the tuple.
T6 v6
The seventh member of the tuple.
T4 v4
The fifth member of the tuple.
T1 v1
The second member of the tuple.
T2 v2
The third member of the tuple.
T8 v8
The ninth member of the tuple.
T3 v3
The fourth member of the tuple.
T1 v1
The second member of the tuple.
T7 v7
The eighth member of the tuple.
T5 v5
The sixth member of the tuple.
T6 v6
The seventh member of the tuple.
T0 v0
The first member of the tuple.
T2 v2
The third member of the tuple.
T8 v8
The ninth member of the tuple.
T3 v3
The fourth member of the tuple.
T4 v4
The fifth member of the tuple.
T4 v4
The fifth member of the tuple.
T6 v6
The seventh member of the tuple.
T0 v0
The first member of the tuple.
T2 v2
The third member of the tuple.
T7 v7
The eighth member of the tuple.
T1 v1
The second member of the tuple.
T5 v5
The sixth member of the tuple.
T3 v3
The fourth member of the tuple.
T6 v6
The seventh member of the tuple.
T4 v4
The fifth member of the tuple.
T5 v5
The sixth member of the tuple.
T2 v2
The third member of the tuple.
T0 v0
The first member of the tuple.
T3 v3
The fourth member of the tuple.
T1 v1
The second member of the tuple.
T2 v2
The third member of the tuple.
T3 v3
The fourth member of the tuple.
T1 v1
The second member of the tuple.
T5 v5
The sixth member of the tuple.
T0 v0
The first member of the tuple.
T4 v4
The fifth member of the tuple.
T0 v0
The first member of the tuple.
T2 v2
The third member of the tuple.
T3 v3
The fourth member of the tuple.
T1 v1
The second member of the tuple.
T4 v4
The fifth member of the tuple.
T3 v3
The fourth member of the tuple.
T0 v0
The first member of the tuple.
T1 v1
The second member of the tuple.
T2 v2
The third member of the tuple.
T2 v2
The third member of the tuple.
T1 v1
The second member of the tuple.
T0 v0
The first member of the tuple.
T1 v1
The second member of the tuple.
T0 v0
The first member of the tuple.
T0 v0
The first member of the tuple.
Head type
the type at the specified index
a struct used to determine the type at index I of a tuple
This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels ...