batmat develop
Batched linear algebra routines
Loading...
Searching...
No Matches
batmat::types Namespace Reference

Classes

struct  Types
struct  Head
struct  Head< Types< T, Ts... > >
struct  Tail
struct  Tail< Types< T, Ts... > >
struct  Concat
struct  Concat<>
struct  Concat< Types< Ts... > >
struct  Concat< Types< Ts1... >, Types< Ts2... >, Rest... >
struct  Map
struct  Map< Func, Types< Ts... > >
struct  FlatMap
struct  FlatMap< Func, Types< Ts... > >
struct  Filter
struct  Filter< Pred, Types< Ts... > >
struct  DTypeVectorLength
struct  VectorLengthIs
struct  DTypeIs

Typedefs

template<template< class > class Func, class List>
using Map_t = typename Map<Func, List>::type
template<template< class > class Func, class List>
using FlatMap_t = typename FlatMap<Func, List>::type
template<template< class > class Pred, class List>
using Filter_t = typename Filter<Pred, List>::type
template<index_t VL, class List>
using FilterVL = FlatMap_t<VectorLengthIs<VL>::template type, List>
template<class Ts>
using GetDType = typename Ts::dtype
using dtype_all = Tail<Types<void , double >>::type
 Types containing all supported dtypes.
using dtype_vl_all = Tail<Types<void , DTypeVectorLength<double, 1> , DTypeVectorLength<double, 4> , DTypeVectorLength<double, 8> >>::type
template<index_t VL>
using dtypes_for_vl = Map_t<GetDType, Filter_t<VectorLengthIs<VL>::template type, dtype_vl_all>>
 Types containing all supported dtypes for a given vector length VL.
template<class DT, index_t VL>
using lookup_dtype_vl
 Types containing the given dtype and vector length combination, if supported.

Functions

template<class F>
constexpr auto foreach_dtype_vl (F &&f)
 Call a given function f for all supported (dtype, VL) combinations.

Variables

template<class DT>
constexpr std::array vl_for_dtype
 Array of supported vector lengths for a given dtype T.
constexpr std::array vl_for_real_t = vl_for_dtype<real_t>
 Array of supported vector lengths for the default real_t.
template<class DT, index_t VL>
constexpr bool is_supported_dtype_vl = !std::is_same_v<lookup_dtype_vl<DT, VL>, Types<>>
 Check if a given (dtype, VL) combination is supported.
template<class DT, index_t VL>
constexpr index_t vl_at_least
 The smallest supported vector length for dtype DT that is greater than or equal to VL.
template<class DT, index_t VL>
constexpr index_t vl_at_most
 The largest supported vector length for dtype DT that is less than or equal to VL.
template<class DT, index_t VL>
constexpr index_t vl_or_largest
 VL if it is a supported vector length for dtype DT, otherwise the largest supported vector length for DT.

Class Documentation

◆ batmat::types::Types

struct batmat::types::Types
Class Members
typedef Template< Args..., Ts... > into Template<Args..., Ts...>

◆ batmat::types::Head

struct batmat::types::Head

◆ batmat::types::Head< Types< T, Ts... > >

struct batmat::types::Head< Types< T, Ts... > >
Class Members
typedef Types< T > type Types<T>

◆ batmat::types::Tail

struct batmat::types::Tail

◆ batmat::types::Tail< Types< T, Ts... > >

struct batmat::types::Tail< Types< T, Ts... > >
Class Members
typedef Types< Ts... > type Types<Ts...>

◆ batmat::types::Concat

struct batmat::types::Concat

◆ batmat::types::Concat<>

struct batmat::types::Concat<>
Class Members
typedef Types<> type Types<>

◆ batmat::types::Concat< Types< Ts... > >

struct batmat::types::Concat< Types< Ts... > >
Class Members
typedef Types< Ts... > type Types<Ts...>

◆ batmat::types::Concat< Types< Ts1... >, Types< Ts2... >, Rest... >

struct batmat::types::Concat< Types< Ts1... >, Types< Ts2... >, Rest... >
Class Members
typedef typename Concat< Types< Ts1..., Ts2... >, Rest... >::type type typename Concat<Types<Ts1..., Ts2...>, Rest...>::type

◆ batmat::types::Map

struct batmat::types::Map

◆ batmat::types::Map< Func, Types< Ts... > >

struct batmat::types::Map< Func, Types< Ts... > >
Class Members
typedef Types< Func< Ts >... > type Types<Func<Ts>...>

◆ batmat::types::FlatMap

struct batmat::types::FlatMap

◆ batmat::types::FlatMap< Func, Types< Ts... > >

struct batmat::types::FlatMap< Func, Types< Ts... > >
Class Members
typedef typename Concat< Func< Ts >... >::type type typename Concat<Func<Ts>...>::type

◆ batmat::types::Filter

struct batmat::types::Filter

◆ batmat::types::Filter< Pred, Types< Ts... > >

struct batmat::types::Filter< Pred, Types< Ts... > >
Class Members
typedef typename value, Types< Ts >, Types<> >... >::type type typename Concat<std::conditional_t<Pred<Ts>::value, Types<Ts>, Types<>>...>::type

◆ batmat::types::VectorLengthIs

struct batmat::types::VectorLengthIs
Class Members
typedef bool_constant< VL==vl > type std::bool_constant<VL == T::vl>

◆ batmat::types::DTypeIs

struct batmat::types::DTypeIs
Class Members
typedef is_same< DT, typename dtype > type std::is_same<DT, typename T::dtype>

Typedef Documentation

◆ Map_t

template<template< class > class Func, class List>
using batmat::types::Map_t = typename Map<Func, List>::type

Definition at line 53 of file dtypes.hpp.

◆ FlatMap_t

template<template< class > class Func, class List>
using batmat::types::FlatMap_t = typename FlatMap<Func, List>::type

Definition at line 62 of file dtypes.hpp.

◆ Filter_t

template<template< class > class Pred, class List>
using batmat::types::Filter_t = typename Filter<Pred, List>::type

Definition at line 71 of file dtypes.hpp.

◆ FilterVL

template<index_t VL, class List>
using batmat::types::FilterVL = FlatMap_t<VectorLengthIs<VL>::template type, List>

Definition at line 93 of file dtypes.hpp.

◆ GetDType

template<class Ts>
using batmat::types::GetDType = typename Ts::dtype

Definition at line 96 of file dtypes.hpp.

◆ dtype_all

using batmat::types::dtype_all = Tail<Types<void , double >>::type

Types containing all supported dtypes.

Definition at line 100 of file dtypes.hpp.

◆ dtype_vl_all

using batmat::types::dtype_vl_all = Tail<Types<void , DTypeVectorLength<double, 1> , DTypeVectorLength<double, 4> , DTypeVectorLength<double, 8> >>::type

Definition at line 104 of file dtypes.hpp.

◆ dtypes_for_vl

template<index_t VL>
using batmat::types::dtypes_for_vl = Map_t<GetDType, Filter_t<VectorLengthIs<VL>::template type, dtype_vl_all>>

Types containing all supported dtypes for a given vector length VL.

Definition at line 118 of file dtypes.hpp.

◆ lookup_dtype_vl

template<class DT, index_t VL>
using batmat::types::lookup_dtype_vl
Initial value:
Tail< Types< void, DTypeVectorLength< double, 1 >, DTypeVectorLength< double, 4 >, DTypeVectorLength< double, 8 > > >::type dtype_vl_all
Definition dtypes.hpp:104
typename Filter< Pred, List >::type Filter_t
Definition dtypes.hpp:71

Types containing the given dtype and vector length combination, if supported.

Definition at line 122 of file dtypes.hpp.

Function Documentation

◆ foreach_dtype_vl()

template<class F>
auto batmat::types::foreach_dtype_vl ( F && f)
constexpr

Call a given function f for all supported (dtype, VL) combinations.

f should be callable with signature void(DTypeVectorLength).

Examples
example.cpp.

Definition at line 177 of file dtypes.hpp.

Variable Documentation

◆ vl_for_dtype

template<class DT>
std::array batmat::types::vl_for_dtype
constexpr
Initial value:
= []<class... Dtvls>(Types<Dtvls...>) {
return std::array<index_t, sizeof...(Dtvls)>{Dtvls::vl...};
}(Filter_t<DTypeIs<DT>::template type, dtype_vl_all>{})

Array of supported vector lengths for a given dtype T.

Definition at line 109 of file dtypes.hpp.

◆ vl_for_real_t

std::array batmat::types::vl_for_real_t = vl_for_dtype<real_t>
constexpr

Array of supported vector lengths for the default real_t.

Definition at line 114 of file dtypes.hpp.

◆ is_supported_dtype_vl

template<class DT, index_t VL>
bool batmat::types::is_supported_dtype_vl = !std::is_same_v<lookup_dtype_vl<DT, VL>, Types<>>
constexpr

Check if a given (dtype, VL) combination is supported.

Definition at line 127 of file dtypes.hpp.

◆ vl_at_least

template<class DT, index_t VL>
index_t batmat::types::vl_at_least
constexpr
Initial value:
= [] {
return VL;
} else {
auto options = vl_for_dtype<DT>;
std::ranges::sort(options, std::less{});
for (auto v : options)
if (v >= VL)
return v;
return index_t{0};
}
}()
constexpr std::array vl_for_dtype
Array of supported vector lengths for a given dtype T.
Definition dtypes.hpp:109
constexpr bool is_supported_dtype_vl
Check if a given (dtype, VL) combination is supported.
Definition dtypes.hpp:127

The smallest supported vector length for dtype DT that is greater than or equal to VL.

Returns 0 if no supported vector length is large enough.

Definition at line 132 of file dtypes.hpp.

◆ vl_at_most

template<class DT, index_t VL>
index_t batmat::types::vl_at_most
constexpr
Initial value:
= [] {
return VL;
} else {
auto options = vl_for_dtype<DT>;
std::ranges::sort(options, std::greater{});
for (auto v : options)
if (v <= VL)
return v;
return index_t{0};
}
}()

The largest supported vector length for dtype DT that is less than or equal to VL.

Returns 0 if no supported vector length is small enough.

Examples
example.cpp.

Definition at line 148 of file dtypes.hpp.

◆ vl_or_largest

template<class DT, index_t VL>
index_t batmat::types::vl_or_largest
constexpr
Initial value:
= [] {
return VL;
} else {
auto options = vl_for_dtype<DT>;
std::ranges::sort(options, std::greater{});
return options.empty() ? index_t{0} : options.front();
}
}()

VL if it is a supported vector length for dtype DT, otherwise the largest supported vector length for DT.

Definition at line 164 of file dtypes.hpp.