Loading include/dca/function/function.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public: // Enable only if all arguments are integral to prevent subind_to_linind(int*, int) to resolve to // subind_to_linind(int...) rather than subind_to_linind(const int* const, int). template <typename... Ts> std::enable_if_t<util::if_all<std::is_integral<Ts>::value...>::value, int> subind_2_linind( std::enable_if_t<util::ifAll(std::is_integral_v<Ts>...), int> subind_2_linind( const Ts... subindices) const { // We need to cast all subindices to the same type for dmn_variadic. return dmn(static_cast<int>(subindices)...); Loading include/dca/phys/dca_step/cluster_solver/ctint/walker/tools/kernels_interface.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ // // Authors: Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // // This file provides access to the kernel building the G0 matrix on the GPU. // Kernel interface for GPU interpolation. #ifndef DCA_PHYS_DCA_STEP_CLUSTER_SOLVER_CTINT_WALKER_TOOLS_KERNELS_INTERFACE_HPP #define DCA_PHYS_DCA_STEP_CLUSTER_SOLVER_CTINT_WALKER_TOOLS_KERNELS_INTERFACE_HPP Loading include/dca/util/pack_operations.hpp +12 −24 Original line number Diff line number Diff line Loading @@ -22,35 +22,23 @@ namespace dca { namespace util { // dca::util:: // if_all<b1, b2, ...>::value is true only if all template arguments are true, otherwise false. template <bool b1, bool... bs> struct if_all { constexpr static bool value = b1 && if_all<bs...>::value; }; template <bool b> struct if_all<b> { constexpr static bool value = b; }; // product(T1 a1, T2 a2, ...) returns the product of all its arguments. Equivalent to a1 * a2 * ... template <typename T> constexpr T product(T first) { return first; // returns is true only if all template arguments are true. template <class... Args> constexpr bool ifAll(Args... args) { return (args &&...); } template <typename T, class... Args> constexpr T product(T first, Args... args) { return first * product<Args...>(args...); // product(T1 a1, T2 a2, ...) returns the product of all its arguments. Equivalent to a1 * a2 * ... template <class... Args> constexpr auto product(Args... args) { return (args *...); } // sum(T1 a1, T2 a2, ...) returns the sum of all its arguments. Equivalent to a1 + a2 + ... template <typename T = void> constexpr unsigned sum() { return 0; } template <typename T, class... Args> constexpr T sum(T first, Args... args) { return first + sum<Args...>(args...); // sum() returns 0. template <class... Args> constexpr auto sum(Args... args) { return (0 + ... + args); } // size_sum. Loading include/dca/util/type_list.hpp +0 −4 Original line number Diff line number Diff line Loading @@ -229,10 +229,6 @@ struct mp_sublist { using type = typename mp_prepend<next, T1>::type; }; template <typename T1, typename... Ts> struct mp_sublist<1, T1, Ts...> { using type = mp_list<T1>; }; template <typename T1, typename... Ts> struct mp_sublist<0, T1, Ts...> { using type = mp_list<>; }; Loading test/unit/util/pack_operations_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -15,10 +15,10 @@ #include "gtest/gtest.h" TEST(PackOperationsTest, IfAll) { constexpr bool b1 = dca::util::if_all<true, std::is_integral<int>::value, 1>::value; constexpr bool b1 = dca::util::ifAll(true, std::is_integral_v<int>, 1); EXPECT_TRUE(b1); constexpr bool b2 = dca::util::if_all<true, std::is_integral<double>::value, 1>::value; constexpr bool b2 = dca::util::ifAll(true, std::is_integral_v<double>, 1); EXPECT_FALSE(b2); } Loading Loading
include/dca/function/function.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public: // Enable only if all arguments are integral to prevent subind_to_linind(int*, int) to resolve to // subind_to_linind(int...) rather than subind_to_linind(const int* const, int). template <typename... Ts> std::enable_if_t<util::if_all<std::is_integral<Ts>::value...>::value, int> subind_2_linind( std::enable_if_t<util::ifAll(std::is_integral_v<Ts>...), int> subind_2_linind( const Ts... subindices) const { // We need to cast all subindices to the same type for dmn_variadic. return dmn(static_cast<int>(subindices)...); Loading
include/dca/phys/dca_step/cluster_solver/ctint/walker/tools/kernels_interface.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ // // Authors: Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // // This file provides access to the kernel building the G0 matrix on the GPU. // Kernel interface for GPU interpolation. #ifndef DCA_PHYS_DCA_STEP_CLUSTER_SOLVER_CTINT_WALKER_TOOLS_KERNELS_INTERFACE_HPP #define DCA_PHYS_DCA_STEP_CLUSTER_SOLVER_CTINT_WALKER_TOOLS_KERNELS_INTERFACE_HPP Loading
include/dca/util/pack_operations.hpp +12 −24 Original line number Diff line number Diff line Loading @@ -22,35 +22,23 @@ namespace dca { namespace util { // dca::util:: // if_all<b1, b2, ...>::value is true only if all template arguments are true, otherwise false. template <bool b1, bool... bs> struct if_all { constexpr static bool value = b1 && if_all<bs...>::value; }; template <bool b> struct if_all<b> { constexpr static bool value = b; }; // product(T1 a1, T2 a2, ...) returns the product of all its arguments. Equivalent to a1 * a2 * ... template <typename T> constexpr T product(T first) { return first; // returns is true only if all template arguments are true. template <class... Args> constexpr bool ifAll(Args... args) { return (args &&...); } template <typename T, class... Args> constexpr T product(T first, Args... args) { return first * product<Args...>(args...); // product(T1 a1, T2 a2, ...) returns the product of all its arguments. Equivalent to a1 * a2 * ... template <class... Args> constexpr auto product(Args... args) { return (args *...); } // sum(T1 a1, T2 a2, ...) returns the sum of all its arguments. Equivalent to a1 + a2 + ... template <typename T = void> constexpr unsigned sum() { return 0; } template <typename T, class... Args> constexpr T sum(T first, Args... args) { return first + sum<Args...>(args...); // sum() returns 0. template <class... Args> constexpr auto sum(Args... args) { return (0 + ... + args); } // size_sum. Loading
include/dca/util/type_list.hpp +0 −4 Original line number Diff line number Diff line Loading @@ -229,10 +229,6 @@ struct mp_sublist { using type = typename mp_prepend<next, T1>::type; }; template <typename T1, typename... Ts> struct mp_sublist<1, T1, Ts...> { using type = mp_list<T1>; }; template <typename T1, typename... Ts> struct mp_sublist<0, T1, Ts...> { using type = mp_list<>; }; Loading
test/unit/util/pack_operations_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -15,10 +15,10 @@ #include "gtest/gtest.h" TEST(PackOperationsTest, IfAll) { constexpr bool b1 = dca::util::if_all<true, std::is_integral<int>::value, 1>::value; constexpr bool b1 = dca::util::ifAll(true, std::is_integral_v<int>, 1); EXPECT_TRUE(b1); constexpr bool b2 = dca::util::if_all<true, std::is_integral<double>::value, 1>::value; constexpr bool b2 = dca::util::ifAll(true, std::is_integral_v<double>, 1); EXPECT_FALSE(b2); } Loading