xgboost
Classes | Typedefs | Functions
xgboost::linalg::detail Namespace Reference

Classes

struct  ArrayInterfaceHandler
 
struct  AllTag
 
struct  IntTag
 
struct  RangeTag
 
struct  Conjunction
 
struct  Conjunction< B1 >
 
struct  Conjunction< B1, Bn... >
 

Typedefs

template<typename S >
using RemoveCRType = std::remove_const_t< std::remove_reference_t< S > >
 
template<typename S >
using IndexToTag = std::conditional_t< std::is_integral< RemoveCRType< S > >::value, IntTag, S >
 
template<typename... Index>
using IsAllIntegral = Conjunction< std::is_integral< std::remove_reference_t< Index > >... >
 
template<typename... Index>
using EnableIfIntegral = std::enable_if_t< IsAllIntegral< Index... >::value >
 

Functions

template<size_t dim, typename S , typename Head , size_t D>
constexpr size_t Offset (S(&strides)[D], size_t n, Head head)
 
template<size_t dim, typename S , size_t D, typename Head , typename... Tail>
constexpr std::enable_if_t< sizeof...(Tail) !=0, size_t > Offset (S(&strides)[D], size_t n, Head head, Tail &&...rest)
 
template<int32_t D, bool f_array = false>
constexpr void CalcStride (size_t const (&shape)[D], size_t(&stride)[D])
 
template<typename T >
constexpr int32_t CalcSliceDim ()
 Calculate the dimension of sliced tensor. More...
 
template<typename T , typename... S>
constexpr std::enable_if_t< sizeof...(S) !=0, int32_t > CalcSliceDim ()
 
template<int32_t D>
constexpr size_t CalcSize (size_t(&shape)[D])
 
template<int32_t n, typename Fn >
constexpr LINALG_HD auto UnrollLoop (Fn fn)
 
template<typename T >
int32_t NativePopc (T v)
 
LINALG_HD int Popc (uint32_t v)
 
LINALG_HD int Popc (uint64_t v)
 
template<std::size_t D, typename Head >
LINALG_HD void IndexToArr (std::size_t(&arr)[D], Head head)
 
template<std::size_t D, typename Head , typename... Rest>
LINALG_HD void IndexToArr (std::size_t(&arr)[D], Head head, Rest &&...index)
 Convert index from parameter pack to C-style array. More...
 
template<class T , std::size_t N, std::size_t... Idx>
constexpr auto ArrToTuple (T(&arr)[N], std::index_sequence< Idx... >)
 
template<class T , std::size_t N>
constexpr auto ArrToTuple (T(&arr)[N])
 Convert C-styple array to std::tuple. More...
 
template<typename I , int32_t D>
LINALG_HD auto UnravelImpl (I idx, common::Span< size_t const, D > shape)
 
template<size_t dim, typename I , int32_t D>
void ReshapeImpl (size_t(&out_shape)[D], I s)
 
template<size_t dim, int32_t D, typename... S, typename I , std::enable_if_t< sizeof...(S) !=0 > * = nullptr>
void ReshapeImpl (size_t(&out_shape)[D], I &&s, S &&...rest)
 
template<typename Fn , typename Tup , size_t... I>
decltype(auto) constexpr LINALG_HD Apply (Fn &&f, Tup &&t, std::index_sequence< I... >)
 
template<typename Fn , typename Tup >
decltype(auto) constexpr LINALG_HD Apply (Fn &&f, Tup &&t)
 

Typedef Documentation

◆ EnableIfIntegral

template<typename... Index>
using xgboost::linalg::detail::EnableIfIntegral = typedef std::enable_if_t<IsAllIntegral<Index...>::value>

◆ IndexToTag

template<typename S >
using xgboost::linalg::detail::IndexToTag = typedef std::conditional_t<std::is_integral<RemoveCRType<S> >::value, IntTag, S>

◆ IsAllIntegral

template<typename... Index>
using xgboost::linalg::detail::IsAllIntegral = typedef Conjunction<std::is_integral<std::remove_reference_t<Index> >...>

◆ RemoveCRType

template<typename S >
using xgboost::linalg::detail::RemoveCRType = typedef std::remove_const_t<std::remove_reference_t<S> >

Function Documentation

◆ Apply() [1/2]

template<typename Fn , typename Tup >
decltype(auto) constexpr LINALG_HD xgboost::linalg::detail::Apply ( Fn &&  f,
Tup &&  t 
)
constexpr

C++ 17 style apply.

Parameters
ffunction to apply
ttuple of arguments

◆ Apply() [2/2]

template<typename Fn , typename Tup , size_t... I>
decltype(auto) constexpr LINALG_HD xgboost::linalg::detail::Apply ( Fn &&  f,
Tup &&  t,
std::index_sequence< I... >   
)
constexpr

◆ ArrToTuple() [1/2]

template<class T , std::size_t N>
constexpr auto xgboost::linalg::detail::ArrToTuple ( T(&)  arr[N])
constexpr

Convert C-styple array to std::tuple.

◆ ArrToTuple() [2/2]

template<class T , std::size_t N, std::size_t... Idx>
constexpr auto xgboost::linalg::detail::ArrToTuple ( T(&)  arr[N],
std::index_sequence< Idx... >   
)
constexpr

◆ CalcSize()

template<int32_t D>
constexpr size_t xgboost::linalg::detail::CalcSize ( size_t(&)  shape[D])
constexpr

◆ CalcSliceDim() [1/2]

template<typename T >
constexpr int32_t xgboost::linalg::detail::CalcSliceDim ( )
constexpr

Calculate the dimension of sliced tensor.

◆ CalcSliceDim() [2/2]

template<typename T , typename... S>
constexpr std::enable_if_t<sizeof...(S) != 0, int32_t> xgboost::linalg::detail::CalcSliceDim ( )
constexpr

◆ CalcStride()

template<int32_t D, bool f_array = false>
constexpr void xgboost::linalg::detail::CalcStride ( size_t const (&)  shape[D],
size_t(&)  stride[D] 
)
constexpr

◆ IndexToArr() [1/2]

template<std::size_t D, typename Head >
LINALG_HD void xgboost::linalg::detail::IndexToArr ( std::size_t(&)  arr[D],
Head  head 
)

◆ IndexToArr() [2/2]

template<std::size_t D, typename Head , typename... Rest>
LINALG_HD void xgboost::linalg::detail::IndexToArr ( std::size_t(&)  arr[D],
Head  head,
Rest &&...  index 
)

Convert index from parameter pack to C-style array.

◆ NativePopc()

template<typename T >
int32_t xgboost::linalg::detail::NativePopc ( v)

◆ Offset() [1/2]

template<size_t dim, typename S , typename Head , size_t D>
constexpr size_t xgboost::linalg::detail::Offset ( S(&)  strides[D],
size_t  n,
Head  head 
)
constexpr

◆ Offset() [2/2]

template<size_t dim, typename S , size_t D, typename Head , typename... Tail>
constexpr std::enable_if_t<sizeof...(Tail) != 0, size_t> xgboost::linalg::detail::Offset ( S(&)  strides[D],
size_t  n,
Head  head,
Tail &&...  rest 
)
constexpr

◆ Popc() [1/2]

LINALG_HD int xgboost::linalg::detail::Popc ( uint32_t  v)
inline

◆ Popc() [2/2]

LINALG_HD int xgboost::linalg::detail::Popc ( uint64_t  v)
inline

◆ ReshapeImpl() [1/2]

template<size_t dim, int32_t D, typename... S, typename I , std::enable_if_t< sizeof...(S) !=0 > * = nullptr>
void xgboost::linalg::detail::ReshapeImpl ( size_t(&)  out_shape[D],
I &&  s,
S &&...  rest 
)

◆ ReshapeImpl() [2/2]

template<size_t dim, typename I , int32_t D>
void xgboost::linalg::detail::ReshapeImpl ( size_t(&)  out_shape[D],
s 
)

◆ UnravelImpl()

template<typename I , int32_t D>
LINALG_HD auto xgboost::linalg::detail::UnravelImpl ( idx,
common::Span< size_t const, D >  shape 
)

◆ UnrollLoop()

template<int32_t n, typename Fn >
constexpr LINALG_HD auto xgboost::linalg::detail::UnrollLoop ( Fn  fn)
constexpr