SUNphi  1.0
IntListOperations.hpp File Reference

Implements operations over list of integers. More...

Go to the source code of this file.

Macros

#define DEFINE_SEARCH_MIN_OR_MAX(NAME, DESCR, OPER)
 Provide a routine to search the minimal or maximal. More...
 

Functions

template<int... Ints>
constexpr int SUNphi::_hSum ()
 
template<int... Ints>
constexpr int SUNphi::_hMul ()
 
template<int In, int Head, int... Tail>
int SUNphi::_maxOfList ()
 
template<int In, int Head, int... Tail>
int SUNphi::_minOfList ()
 

Variables

template<int... Ints>
constexpr int SUNphi::hSum
 Sum of all integers. More...
 
template<int I, int Head = 0, int... Tail>
constexpr int SUNphi::hSumFirst
 Sum of all integers up to I (excluded) More...
 
template<int I, int Head>
constexpr int SUNphi::hSumFirst< I, Head >
 Sum of all integers up to I (excluded),unary case. More...
 
template<int... Ints>
constexpr int SUNphi::hMul
 Product of all integers. More...
 
template<int Head, int... Tail>
constexpr int SUNphi::maxOfList = _maxOfList<Head,Head,Tail...>()
 
template<int Head, int... Tail>
constexpr int SUNphi::minOfList = _minOfList<Head,Head,Tail...>()
 

Detailed Description

Implements operations over list of integers.

Definition in file IntListOperations.hpp.

Macro Definition Documentation

#define DEFINE_SEARCH_MIN_OR_MAX (   NAME,
  DESCR,
  OPER 
)
Value:
\ \ \
template <int In, \
int Head, \
int...Tail> \
int _ ## NAME ## OfList() \
{ \
/* Binary comparison */ \
constexpr int Tmp=(In OPER Head)?In:Head; \
\
/* Decide to return or nest */ \
if constexpr(sizeof...(Tail)==0) \
return Tmp; \
else \
return _ ## NAME ## OfList<Tmp,Tail...>; \
} \
\ \
template <int Head, \
int...Tail> \
[[ maybe_unused ]] \
constexpr int NAME ## OfList= \
_ ## NAME ## OfList<Head,Head,Tail...>()

Provide a routine to search the minimal or maximal.

Definition at line 68 of file IntListOperations.hpp.

Function Documentation

template<int... Ints>
constexpr int SUNphi::_hMul ( )

Product of all integers

Internal implementation

Definition at line 51 of file IntListOperations.hpp.

template<int... Ints>
constexpr int SUNphi::_hSum ( )

Sum of all integers

Internal implementation

Definition at line 14 of file IntListOperations.hpp.

template<int In, int Head, int... Tail>
int SUNphi::_maxOfList ( )

Maximal of all integers

Internal implementation

Definition at line 96 of file IntListOperations.hpp.

template<int In, int Head, int... Tail>
int SUNphi::_minOfList ( )

Minimal of all integers

Internal implementation

Definition at line 97 of file IntListOperations.hpp.

Variable Documentation

template<int... Ints>
constexpr int SUNphi::hMul
Initial value:
=
_hMul<Ints...>()
constexpr int _hMul()

Product of all integers.

Definition at line 62 of file IntListOperations.hpp.

template<int... Ints>
constexpr int SUNphi::hSum
Initial value:
=
_hSum<Ints...>()
constexpr int _hSum()

Sum of all integers.

Definition at line 25 of file IntListOperations.hpp.

template<int I, int Head = 0, int... Tail>
constexpr int SUNphi::hSumFirst
Initial value:
=
(I>0)*Head+hSumFirst<I-1,Tail...>

Sum of all integers up to I (excluded)

Definition at line 35 of file IntListOperations.hpp.

template<int I, int Head>
constexpr int SUNphi::hSumFirst< I, Head >
Initial value:
=
(I>0)*Head

Sum of all integers up to I (excluded),unary case.

Definition at line 41 of file IntListOperations.hpp.

template<int Head, int... Tail>
constexpr int SUNphi::maxOfList = _maxOfList<Head,Head,Tail...>()

Maximal of all integers

Definition at line 96 of file IntListOperations.hpp.

template<int Head, int... Tail>
constexpr int SUNphi::minOfList = _minOfList<Head,Head,Tail...>()

Minimal of all integers

Definition at line 97 of file IntListOperations.hpp.