3#include <batmat/config.hpp>
13 template <
template <
class...>
class Template,
class... Args>
14 using into = Template<Args..., Ts...>;
19template <
class T,
class... Ts>
26template <
class T,
class... Ts>
41template <
class... Ts1,
class... Ts2,
class... Rest>
46template <
template <
class>
class Func,
class>
48template <
template <
class>
class Func,
class... Ts>
52template <
template <
class>
class Func,
class List>
55template <
template <
class>
class Func,
class>
57template <
template <
class>
class Func,
class... Ts>
61template <
template <
class>
class Func,
class List>
64template <
template <
class>
class Pred,
class>
66template <
template <
class>
class Pred,
class... Ts>
70template <
template <
class>
class Pred,
class List>
73template <
class T, index_t VL>
76 using vl_t = std::integral_constant<index_t, VL>;
77 static constexpr index_t
vl = VL;
83 using type = std::bool_constant<VL == T::vl>;
89 using type = std::is_same<DT, typename T::dtype>;
92template <index_t VL,
class List>
98#define BATMAT_PREFIX_COMMA(...) , __VA_ARGS__
103#define BATMAT_INST_DT_VL(DT, VL) , DTypeVectorLength<DT, VL>
105#undef BATMAT_INST_DT_VL
110 return std::array<index_t,
sizeof...(Dtvls)>{Dtvls::vl...};
121template <
class DT, index_t VL>
126template <
class DT, index_t VL>
131template <
class DT, index_t VL>
137 std::ranges::sort(options, std::less{});
138 for (
auto v : options)
147template <
class DT, index_t VL>
153 std::ranges::sort(options, std::greater{});
154 for (
auto v : options)
163template <
class DT, index_t VL>
169 std::ranges::sort(options, std::greater{});
170 return options.empty() ? index_t{0} : options.front();
#define BATMAT_INST_DT_VL(DT, VL)
Types containing DTypeVectorLength for all supported (dtype, VL) combinations.
#define BATMAT_PREFIX_COMMA(...)
typename Map< Func, List >::type Map_t
Types< Func< Ts >... > type
typename FlatMap< Func, List >::type FlatMap_t
Tail< Types< void, DTypeVectorLength< double, 1 >, DTypeVectorLength< double, 4 >, DTypeVectorLength< double, 8 > > >::type dtype_vl_all
std::is_same< DT, typename T::dtype > type
Template< Args..., Ts... > into
typename Concat< Types< Ts1..., Ts2... >, Rest... >::type type
std::bool_constant< VL==T::vl > type
typename Concat< Func< Ts >... >::type type
constexpr auto foreach_dtype_vl(F &&f)
Call a given function f for all supported (dtype, VL) combinations.
typename Filter< Pred, List >::type Filter_t
constexpr index_t vl_or_largest
VL if it is a supported vector length for dtype DT, otherwise the largest supported vector length for...
constexpr std::array vl_for_dtype
Array of supported vector lengths for a given dtype T.
constexpr std::array vl_for_real_t
Array of supported vector lengths for the default real_t.
typename Ts::dtype GetDType
constexpr index_t vl_at_most
The largest supported vector length for dtype DT that is less than or equal to VL.
constexpr index_t vl_at_least
The smallest supported vector length for dtype DT that is greater than or equal to VL.
FlatMap_t< VectorLengthIs< VL >::template type, List > FilterVL
Map_t< GetDType, Filter_t< VectorLengthIs< VL >::template type, dtype_vl_all > > dtypes_for_vl
Types containing all supported dtypes for a given vector length VL.
Tail< Types< void, double > >::type dtype_all
Types containing all supported dtypes.
Filter_t< DTypeIs< DT >::template type, Filter_t< VectorLengthIs< VL >::template type, dtype_vl_all > > lookup_dtype_vl
Types containing the given dtype and vector length combination, if supported.
typename Concat< std::conditional_t< Pred< Ts >::value, Types< Ts >, Types<> >... >::type type
constexpr bool is_supported_dtype_vl
Check if a given (dtype, VL) combination is supported.
std::integral_constant< index_t, VL > vl_t
static constexpr index_t vl