timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::math Namespace Reference

Classes

struct  compute
 Struct for performing math operations on complex data structures without using globally overload operators (e.g. lhs += rhs) and generic functions (lhs = abs(rhs)) More...
 
struct  compute< null_type, null_type >
 
struct  compute< type_list<>, type_list<> >
 

Functions

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0, enable_if_t< std::is_integral< Tp >::value &&std::is_unsigned< Tp >::value > = 0>
auto abs (Tp _val, type_list<>) -> decltype(Tp{})
 
template<typename Tp , typename Vp = typename Tp::value_type>
auto abs (Tp _val, type_list<>,...) -> decltype(std::begin(_val), Tp{})
 
template<template< typename... > class Tuple, typename... Types, size_t... Idx>
auto abs (Tuple< Types... > _val, index_sequence< Idx... >) -> decltype(std::get< 0 >(_val), Tuple< Types... >())
 
template<typename Tp >
Tp abs (Tp _val)
 
template<typename Tp , typename Up >
void assign (Tp &_lhs, Up &&_rhs)
 
template<typename Tp , typename Up >
auto divide (Tp &_lhs, Up _rhs, type_list<>,...) -> decltype(_lhs/=_rhs, void())
 
template<typename Tp , typename Up , typename Vp = typename Tp::value_type, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto divide (Tp &_lhs, const Up &_rhs, type_list<>, long) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto divide (Tp &_lhs, const Up &_rhs, type_list<>, int) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up >
auto divide (Tp &, const Up &, index_sequence<>, int)
 
template<typename Tp , typename Up , size_t... Idx, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto divide (Tp &_lhs, const Up &_rhs, index_sequence< Idx... >, long) -> decltype(std::get< 0 >(_lhs), void())
 
template<typename Tp , typename Up , enable_if_t<!concepts::is_null_type< Tp >::value > >
Tp & divide (Tp &_lhs, const Up &_rhs)
 
template<typename Tp >
bool is_finite (const Tp &val)
 
template<typename Tp >
Tp sqrt (Tp)
 
template<typename Tp >
Tp pow (Tp, double)
 
template<typename Tp >
Tp sqr (Tp)
 
template<typename Tp >
Tp min (const Tp &, const Tp &)
 
template<typename Tp >
Tp max (const Tp &, const Tp &)
 
template<typename Tp , typename Up = Tp, enable_if_t<!concepts::is_null_type< Tp >::value > = 0>
Tp & plus (Tp &, const Up &)
 
template<typename Tp , typename Up = Tp, enable_if_t<!concepts::is_null_type< Tp >::value > = 0>
Tp & minus (Tp &, const Up &)
 
template<typename Tp , typename Up = Tp, enable_if_t<!concepts::is_null_type< Tp >::value > = 0>
Tp & multiply (Tp &, const Up &)
 
template<typename Tp >
Tp percent_diff (const Tp &, const Tp &)
 
std::tuple abs (std::tuple<>)
 
std::tuple sqrt (std::tuple<>)
 
std::tuple pow (std::tuple<>, double)
 
std::tuple sqr (std::tuple<>)
 
std::tuple min (const std::tuple<> &, const std::tuple<> &)
 
std::tuple max (const std::tuple<> &, const std::tuple<> &)
 
void assign (std::tuple<> &, std::tuple<> &&)
 
std::tuple & plus (std::tuple<> &lhs, const std::tuple<> &)
 
std::tuple & minus (std::tuple<> &lhs, const std::tuple<> &)
 
std::tuple & multiply (std::tuple<> &lhs, const std::tuple<> &)
 
std::tuple & divide (std::tuple<> &lhs, const std::tuple<> &)
 
std::tuple percent_diff (const std::tuple<> &, const std::tuple<> &)
 
template<typename Up >
std::tuple & plus (std::tuple<> &lhs, Up &&)
 
template<typename Up >
std::tuple & minus (std::tuple<> &lhs, Up &&)
 
template<typename Up >
std::tuple & multiply (std::tuple<> &lhs, Up &&)
 
template<typename Up >
std::tuple & divide (std::tuple<> &lhs, Up &&)
 
std::tuple & divide (std::tuple<> &lhs, uint64_t)
 
std::tuple & divide (std::tuple<> &lhs, int64_t)
 
null_type abs (null_type)
 
null_type sqrt (null_type)
 
null_type pow (null_type, double)
 
null_type sqr (null_type)
 
null_type min (const null_type &, const null_type &)
 
null_type max (const null_type &, const null_type &)
 
void assign (null_type &, null_type &&)
 
null_typeplus (null_type &lhs, const null_type &)
 
null_typeminus (null_type &lhs, const null_type &)
 
null_typemultiply (null_type &lhs, const null_type &)
 
null_typedivide (null_type &lhs, const null_type &)
 
null_type percent_diff (const null_type &, const null_type &)
 
template<typename Up >
null_typeplus (null_type &lhs, Up &&)
 
template<typename Up >
null_typeminus (null_type &lhs, Up &&)
 
template<typename Up >
null_typemultiply (null_type &lhs, Up &&)
 
template<typename Up >
null_typedivide (null_type &lhs, Up &&)
 
null_typedivide (null_type &lhs, uint64_t)
 
null_typedivide (null_type &lhs, int64_t)
 
type_list pow (type_list<>, double)
 
type_list min (const type_list<> &, const type_list<> &)
 
type_list max (const type_list<> &, const type_list<> &)
 
void assign (type_list<> &, type_list<> &&)
 
type_listplus (type_list<> &lhs, const type_list<> &)
 
type_listminus (type_list<> &lhs, const type_list<> &)
 
type_listmultiply (type_list<> &lhs, const type_list<> &)
 
type_listdivide (type_list<> &lhs, const type_list<> &)
 
type_list percent_diff (const type_list<> &, const type_list<> &)
 
template<typename Up >
type_listplus (type_list<> &lhs, Up &&)
 
template<typename Up >
type_listminus (type_list<> &lhs, Up &&)
 
template<typename Up >
type_listmultiply (type_list<> &lhs, Up &&)
 
template<typename Up >
type_listdivide (type_list<> &lhs, Up &&)
 
type_listdivide (type_list<> &lhs, uint64_t)
 
type_listdivide (type_list<> &lhs, int64_t)
 
template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
Tp max (Tp _lhs, Tp _rhs, type_list<>)
 
template<typename Tp , typename Vp = typename Tp::value_type>
auto max (const Tp &_lhs, const Tp &_rhs, type_list<>,...) -> decltype(std::begin(_lhs), Tp{})
 
template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto max (const Tp &_lhs, const Tp &_rhs, type_list<>) -> decltype(std::begin(_lhs), Tp{})
 
template<typename Tp , size_t... Idx>
auto max (const Tp &_lhs, const Tp &_rhs, index_sequence< Idx... >) -> decltype(std::get< 0 >(_lhs), Tp{})
 
template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
Tp min (Tp _lhs, Tp _rhs, type_list<>)
 
template<typename Tp , typename Vp = typename Tp::value_type>
auto min (const Tp &_lhs, const Tp &_rhs, type_list<>,...) -> decltype(std::begin(_lhs), Tp{})
 
template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto min (const Tp &_lhs, const Tp &_rhs, type_list<>) -> decltype(std::begin(_lhs), Tp{})
 
template<typename Tp , size_t... Idx>
auto min (const Tp &_lhs, const Tp &_rhs, index_sequence< Idx... >) -> decltype(std::get< 0 >(_lhs), Tp{})
 
template<typename Tp , typename Up >
auto minus (Tp &_lhs, const Up &_rhs, type_list<>,...) -> decltype(_lhs -=_rhs, void())
 
template<typename Tp , typename Up , typename Vp = typename Tp::value_type>
auto minus (Tp &_lhs, const Up &_rhs, type_list<>, long) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto minus (Tp &_lhs, const Up &_rhs, type_list<>, int) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up >
auto minus (Tp &, const Up &, index_sequence<>, int)
 
template<typename Tp , typename Up , size_t... Idx>
auto minus (Tp &_lhs, const Up &_rhs, index_sequence< Idx... >, long) -> decltype(std::get< 0 >(_lhs), void())
 
template<typename Tp , typename Up >
auto multiply (Tp &_lhs, Up _rhs, type_list<>,...) -> decltype(_lhs *=_rhs, void())
 
template<typename Tp , typename Up , typename Vp = typename Tp::value_type>
auto multiply (Tp &_lhs, const Up &_rhs, type_list<>, long) -> decltype((std::begin(_lhs), std::begin(_rhs)), void())
 
template<typename Tp , typename Up , typename Vp = typename Tp::value_type, enable_if_t< std::is_arithmetic< Up >::value > = 0>
auto multiply (Tp &_lhs, const Up &_rhs, type_list<>, long) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto multiply (Tp &_lhs, const Up &_rhs, type_list<>, int) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up >
auto multiply (Tp &, const Up &, index_sequence<>, int)
 
template<typename Tp , typename Up , size_t... Idx, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto multiply (Tp &_lhs, const Up &_rhs, index_sequence< Idx... >, long) -> decltype(std::get< 0 >(_lhs), void())
 
template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
Tp percent_diff (Tp _lhs, Tp _rhs, type_list<>,...)
 
template<typename Tp , enable_if_t<!std::is_arithmetic< Tp >::value &&std::is_class< Tp >::value > = 0>
auto percent_diff (Tp _lhs, Tp _rhs, type_list<>,...) -> decltype(_lhs.percent_diff(_rhs))
 
template<typename Tp , typename Vp = typename Tp::value_type>
auto percent_diff (const Tp &_lhs, const Tp &_rhs, type_list<>, long) -> decltype(std::begin(_lhs), Tp{})
 
template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto percent_diff (const Tp &_lhs, const Tp &_rhs, type_list<>, int) -> decltype(std::begin(_lhs), Tp{})
 
template<typename Tp , size_t... Idx>
auto percent_diff (const Tp &_lhs, const Tp &_rhs, index_sequence< Idx... >,...) -> decltype(std::get< 0 >(_lhs), Tp{})
 
template<typename Tp , typename Up >
auto plus (Tp &_lhs, const Up &_rhs, type_list<>,...) -> decltype(_lhs+=_rhs, void())
 
template<typename Tp , typename Up , typename Vp = typename Tp::value_type>
auto plus (Tp &_lhs, const Up &_rhs, type_list<>, long) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto plus (Tp &_lhs, const Up &_rhs, type_list<>, int) -> decltype(std::begin(_lhs), void())
 
template<typename Tp , typename Up >
auto plus (Tp &, const Up &, index_sequence<>, int)
 
template<typename Tp , typename Up , size_t... Idx>
auto plus (Tp &_lhs, const Up &_rhs, index_sequence< Idx... >, long) -> decltype(std::get< 0 >(_lhs), void())
 
template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
auto pow (Tp _val, double _m, type_list<>) -> decltype(std::pow(_val, _m), Tp{})
 
template<typename Tp , typename Vp = typename Tp::value_type>
auto pow (Tp _val, double _m, type_list<>,...) -> decltype(std::begin(_val), Tp{})
 
template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto pow (Tp _val, double _m, type_list<>) -> decltype(std::begin(_val), Tp{})
 
template<template< typename... > class Tuple, typename... Types, size_t... Idx>
auto pow (Tuple< Types... > _val, double _m, index_sequence< Idx... >) -> decltype(std::get< 0 >(_val), Tuple< Types... >())
 
template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
auto sqrt (Tp _val, type_list<>) -> decltype(std::sqrt(_val), Tp{})
 
template<typename Tp , typename Vp = typename Tp::value_type>
auto sqrt (Tp _val, type_list<>,...) -> decltype(std::begin(_val), Tp{})
 
template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto sqrt (Tp _val, type_list<>) -> decltype(std::begin(_val), Tp{})
 
template<template< typename... > class Tuple, typename... Types, size_t... Idx>
auto sqrt (Tuple< Types... > _val, index_sequence< Idx... >) -> decltype(std::get< 0 >(_val), Tuple< Types... >())
 

Variables

type_list abs (type_list<>)
 
type_list sqrt (type_list<>)
 
type_list sqr (type_list<>)
 

Function Documentation

◆ abs() [1/6]

null_type tim::math::abs ( null_type  )

Definition at line 404 of file fwd.hpp.

409{

◆ abs() [2/6]

std::tuple tim::math::abs ( std::tuple<>  )

Definition at line 403 of file fwd.hpp.

409{

◆ abs() [3/6]

template<typename Tp >
Tp tim::math::abs ( Tp  _val)

Definition at line 89 of file abs.hpp.

References abs().

Referenced by abs().

◆ abs() [4/6]

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0, enable_if_t< std::is_integral< Tp >::value &&std::is_unsigned< Tp >::value > = 0>
auto tim::math::abs ( Tp  _val,
type_list<>   
) -> decltype(Tp{})

Definition at line 44 of file abs.hpp.

44 {})
45{
46 return _val;
47}

◆ abs() [5/6]

template<typename Tp , typename Vp = typename Tp::value_type>
auto tim::math::abs ( Tp  _val,
type_list<>  ,
  ... 
) -> decltype(std::begin(_val), Tp{})

Definition at line 59 of file abs.hpp.

59 {})
60{
61 for(auto& itr : _val)
62 itr = ::tim::math::abs(itr);
63 return _val;
64}

◆ abs() [6/6]

template<template< typename... > class Tuple, typename... Types, size_t... Idx>
auto tim::math::abs ( Tuple< Types... >  _val,
index_sequence< Idx... >   
) -> decltype(std::get<0>(_val), Tuple<Types...>())

Definition at line 80 of file abs.hpp.

82{
83 TIMEMORY_FOLD_EXPRESSION(std::get<Idx>(_val) = ::tim::math::abs(std::get<Idx>(_val)));
84 return _val;
85}
type_list abs(type_list<>)
Definition: fwd.hpp:405
#define TIMEMORY_FOLD_EXPRESSION(...)
Definition: types.hpp:56

References abs, and TIMEMORY_FOLD_EXPRESSION.

◆ assign() [1/4]

void tim::math::assign ( null_type ,
null_type &&   
)

Definition at line 404 of file fwd.hpp.

409{

◆ assign() [2/4]

void tim::math::assign ( std::tuple<> &  ,
std::tuple<> &&   
)

Definition at line 403 of file fwd.hpp.

409{

◆ assign() [3/4]

template<typename Tp , typename Up >
void tim::math::assign ( Tp &  _lhs,
Up &&  _rhs 
)

Definition at line 43 of file assign.hpp.

44{
45 _lhs = std::forward<Up>(_rhs);
46}

◆ assign() [4/4]

void tim::math::assign ( type_list<> &  ,
type_list<> &&   
)

Definition at line 405 of file fwd.hpp.

409{

◆ divide() [1/18]

null_type & tim::math::divide ( null_type lhs,
const null_type  
)

Definition at line 404 of file fwd.hpp.

409{

◆ divide() [2/18]

null_type & tim::math::divide ( null_type lhs,
int64_t   
)

Definition at line 404 of file fwd.hpp.

409{

◆ divide() [3/18]

null_type & tim::math::divide ( null_type lhs,
uint64_t   
)

Definition at line 404 of file fwd.hpp.

409{

◆ divide() [4/18]

template<typename Up >
null_type & tim::math::divide ( null_type lhs,
Up &&   
)

Definition at line 404 of file fwd.hpp.

409{

◆ divide() [5/18]

std::tuple & tim::math::divide ( std::tuple<> &  lhs,
const std::tuple<> &   
)

Definition at line 403 of file fwd.hpp.

409{

◆ divide() [6/18]

std::tuple & tim::math::divide ( std::tuple<> &  lhs,
int64_t   
)

Definition at line 403 of file fwd.hpp.

409{

◆ divide() [7/18]

std::tuple & tim::math::divide ( std::tuple<> &  lhs,
uint64_t   
)

Definition at line 403 of file fwd.hpp.

409{

◆ divide() [8/18]

template<typename Up >
std::tuple & tim::math::divide ( std::tuple<> &  lhs,
Up &&   
)

Definition at line 403 of file fwd.hpp.

409{

◆ divide() [9/18]

template<typename Tp , typename Up >
auto tim::math::divide ( Tp &  ,
const Up &  ,
index_sequence<>  ,
int   
)

Definition at line 114 of file divide.hpp.

115{}

◆ divide() [10/18]

template<typename Tp , typename Up , enable_if_t<!concepts::is_null_type< Tp >::value > >
Tp & tim::math::divide ( Tp &  _lhs,
const Up &  _rhs 
)

Definition at line 139 of file divide.hpp.

140{
142 return _lhs;
143}
Tp & divide(Tp &_lhs, const Up &_rhs)
Definition: divide.hpp:139

References divide().

◆ divide() [11/18]

template<typename Tp , typename Up , size_t... Idx, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto tim::math::divide ( Tp &  _lhs,
const Up &  _rhs,
index_sequence< Idx... >  ,
long   
) -> decltype(std::get<0>(_lhs), void())

Definition at line 120 of file divide.hpp.

122{
123 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
124 TIMEMORY_FOLD_EXPRESSION(divide(std::get<Idx>(_lhs), std::get<Idx>(_rhs)));
125}
concept that specifies that a type is not a useful type
Definition: concepts.hpp:159

References divide(), and TIMEMORY_FOLD_EXPRESSION.

◆ divide() [12/18]

template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto tim::math::divide ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
int   
) -> decltype(std::begin(_lhs), void())

Definition at line 85 of file divide.hpp.

86{
87 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
88
89 for(auto litr = std::begin(_lhs); litr != std::end(_lhs); ++litr)
90 {
91 auto ritr = _rhs.find(litr->first);
92 if(ritr == std::end(_rhs))
93 continue;
94 divide(litr->second, ritr->second);
95 }
96}
return _hash_map end()

References divide().

◆ divide() [13/18]

template<typename Tp , typename Up , typename Vp = typename Tp::value_type, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto tim::math::divide ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
long   
) -> decltype(std::begin(_lhs), void())

Definition at line 52 of file divide.hpp.

53{
54 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
55 auto _n = mpl::get_size(_rhs);
56 if(mpl::get_size(_lhs) < _n)
57 mpl::resize(_lhs, _n);
58
59 for(decltype(_n) i = 0; i < _n; ++i)
60 {
61 auto litr = std::begin(_lhs) + i;
62 auto ritr = std::begin(_rhs) + i;
63 divide(*litr, *ritr);
64 }
65}
auto resize(T &,...) -> void
Definition: types.hpp:929
constexpr auto get_size(const Tp &, std::tuple<>) -> size_t
Definition: types.hpp:877

References divide(), tim::mpl::get_size(), and tim::mpl::resize().

◆ divide() [14/18]

template<typename Tp , typename Up >
auto tim::math::divide ( Tp &  _lhs,
Up  _rhs,
type_list<>  ,
  ... 
) -> decltype(_lhs /= _rhs, void())

◆ divide() [15/18]

type_list & tim::math::divide ( type_list<> &  lhs,
const type_list<> &   
)

Definition at line 405 of file fwd.hpp.

409{

◆ divide() [16/18]

type_list & tim::math::divide ( type_list<> &  lhs,
int64_t   
)

Definition at line 405 of file fwd.hpp.

409{

◆ divide() [17/18]

type_list & tim::math::divide ( type_list<> &  lhs,
uint64_t   
)

Definition at line 405 of file fwd.hpp.

409{

◆ divide() [18/18]

template<typename Up >
type_list & tim::math::divide ( type_list<> &  lhs,
Up &&   
)

Definition at line 405 of file fwd.hpp.

409{

◆ is_finite()

template<typename Tp >
bool tim::math::is_finite ( const Tp &  val)

Definition at line 42 of file fwd.hpp.

43{
44#if defined(TIMEMORY_WINDOWS)
45 const Tp _infv = std::numeric_limits<Tp>::infinity();
46 const Tp _inf = (val < 0.0) ? -_infv : _infv;
47 return (val == val && val != _inf);
48#else
49 return std::isfinite(val);
50#endif
51}
bool isfinite(const Tp &arg)
Definition: utility.hpp:104

References tim::isfinite().

◆ max() [1/8]

null_type tim::math::max ( const null_type ,
const null_type  
)

Definition at line 404 of file fwd.hpp.

409{

◆ max() [2/8]

std::tuple tim::math::max ( const std::tuple<> &  ,
const std::tuple<> &   
)

Definition at line 403 of file fwd.hpp.

409{

◆ max() [3/8]

template<typename Tp >
Tp tim::math::max ( const Tp &  _lhs,
const Tp &  _rhs 
)

Definition at line 112 of file max.hpp.

113{
114 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
115 return max(_lhs, _rhs, get_index_sequence<Tp>::value);
116}
auto max(const Tp &_lhs, const Tp &_rhs, index_sequence< Idx... >) -> decltype(std::get< 0 >(_lhs), Tp{})
Definition: max.hpp:100

References max().

Referenced by max().

◆ max() [4/8]

template<typename Tp , size_t... Idx>
auto tim::math::max ( const Tp &  _lhs,
const Tp &  _rhs,
index_sequence< Idx... >   
) -> decltype(std::get<0>(_lhs), Tp{})

Definition at line 100 of file max.hpp.

101 {})
102{
103 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
104 Tp _ret{};
106 std::get<Idx>(_ret) = ::tim::math::max(std::get<Idx>(_lhs), std::get<Idx>(_rhs)));
107 return _ret;
108}
const hash_alias_ptr_t hash_value_t std::string *& _ret
Definition: definition.hpp:300
Tp max(const Tp &, const Tp &)
Definition: max.hpp:112

◆ max() [5/8]

template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto tim::math::max ( const Tp &  _lhs,
const Tp &  _rhs,
type_list<>   
) -> decltype(std::begin(_lhs), Tp{})

Definition at line 76 of file max.hpp.

76 {})
77{
78 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
79 auto _nl = mpl::get_size(_lhs);
80 auto _nr = mpl::get_size(_rhs);
81 using Int_t = decltype(_nl);
82 assert(_nl == _nr);
83
84 auto _n = std::min<Int_t>(_nl, _nr);
85 Tp _ret{};
86 mpl::resize(_ret, _n);
87
88 for(Int_t i = 0; i < _n; ++i)
89 {
90 auto litr = std::begin(_lhs) + i;
91 auto ritr = std::begin(_rhs) + i;
92 auto itr = std::begin(_ret) + i;
93 itr->second = ::tim::math::max(litr->second, ritr->second);
94 }
95 return _ret;
96}

◆ max() [6/8]

template<typename Tp , typename Vp = typename Tp::value_type>
auto tim::math::max ( const Tp &  _lhs,
const Tp &  _rhs,
type_list<>  ,
  ... 
) -> decltype(std::begin(_lhs), Tp{})

Definition at line 51 of file max.hpp.

51 {})
52{
53 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
54 auto _nl = mpl::get_size(_lhs);
55 auto _nr = mpl::get_size(_rhs);
56 using Int_t = decltype(_nl);
57 assert(_nl == _nr);
58
59 auto _n = std::min<Int_t>(_nl, _nr);
60 Tp _ret{};
61 mpl::resize(_ret, _n);
62
63 for(Int_t i = 0; i < _n; ++i)
64 {
65 auto litr = std::begin(_lhs) + i;
66 auto ritr = std::begin(_rhs) + i;
67 auto itr = std::begin(_ret) + i;
68 *itr = ::tim::math::max(*litr, *ritr);
69 }
70 return _ret;
71}

◆ max() [7/8]

type_list tim::math::max ( const type_list<> &  ,
const type_list<> &   
)

Definition at line 405 of file fwd.hpp.

409{

◆ max() [8/8]

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
Tp tim::math::max ( Tp  _lhs,
Tp  _rhs,
type_list<>   
)

Definition at line 43 of file max.hpp.

44{
45 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
46 return (_rhs < _lhs) ? _lhs : _rhs;
47}

◆ min() [1/8]

null_type tim::math::min ( const null_type ,
const null_type  
)

Definition at line 404 of file fwd.hpp.

409{

◆ min() [2/8]

std::tuple tim::math::min ( const std::tuple<> &  ,
const std::tuple<> &   
)

Definition at line 403 of file fwd.hpp.

409{

◆ min() [3/8]

template<typename Tp >
Tp tim::math::min ( const Tp &  _lhs,
const Tp &  _rhs 
)

Definition at line 112 of file min.hpp.

113{
114 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
115 return min(_lhs, _rhs, get_index_sequence<Tp>::value);
116}
auto min(const Tp &_lhs, const Tp &_rhs, index_sequence< Idx... >) -> decltype(std::get< 0 >(_lhs), Tp{})
Definition: min.hpp:100

References min().

Referenced by min().

◆ min() [4/8]

template<typename Tp , size_t... Idx>
auto tim::math::min ( const Tp &  _lhs,
const Tp &  _rhs,
index_sequence< Idx... >   
) -> decltype(std::get<0>(_lhs), Tp{})

Definition at line 100 of file min.hpp.

101 {})
102{
103 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
104 Tp _ret{};
106 std::get<Idx>(_ret) = ::tim::math::min(std::get<Idx>(_lhs), std::get<Idx>(_rhs)));
107 return _ret;
108}
Tp min(const Tp &, const Tp &)
Definition: min.hpp:112

◆ min() [5/8]

template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto tim::math::min ( const Tp &  _lhs,
const Tp &  _rhs,
type_list<>   
) -> decltype(std::begin(_lhs), Tp{})

Definition at line 76 of file min.hpp.

76 {})
77{
78 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
79 auto _nl = mpl::get_size(_lhs);
80 auto _nr = mpl::get_size(_rhs);
81 using Int_t = decltype(_nl);
82 assert(_nl == _nr);
83
84 auto _n = std::min<Int_t>(_nl, _nr);
85 Tp _ret{};
86 mpl::resize(_ret, _n);
87
88 for(Int_t i = 0; i < _n; ++i)
89 {
90 auto litr = std::begin(_lhs) + i;
91 auto ritr = std::begin(_rhs) + i;
92 auto itr = std::begin(_ret) + i;
93 itr->second = ::tim::math::min(litr->second, ritr->second);
94 }
95 return _ret;
96}

◆ min() [6/8]

template<typename Tp , typename Vp = typename Tp::value_type>
auto tim::math::min ( const Tp &  _lhs,
const Tp &  _rhs,
type_list<>  ,
  ... 
) -> decltype(std::begin(_lhs), Tp{})

Definition at line 51 of file min.hpp.

51 {})
52{
53 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
54 auto _nl = mpl::get_size(_lhs);
55 auto _nr = mpl::get_size(_rhs);
56 using Int_t = decltype(_nl);
57 assert(_nl == _nr);
58
59 auto _n = std::min<Int_t>(_nl, _nr);
60 Tp _ret{};
61 mpl::resize(_ret, _n);
62
63 for(Int_t i = 0; i < _n; ++i)
64 {
65 auto litr = std::begin(_lhs) + i;
66 auto ritr = std::begin(_rhs) + i;
67 auto itr = std::begin(_ret) + i;
68 *itr = ::tim::math::min(*litr, *ritr);
69 }
70 return _ret;
71}

◆ min() [7/8]

type_list tim::math::min ( const type_list<> &  ,
const type_list<> &   
)

Definition at line 405 of file fwd.hpp.

409{

◆ min() [8/8]

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
Tp tim::math::min ( Tp  _lhs,
Tp  _rhs,
type_list<>   
)

Definition at line 43 of file min.hpp.

44{
45 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
46 return (_rhs > _lhs) ? _lhs : _rhs;
47}

◆ minus() [1/12]

null_type & tim::math::minus ( null_type lhs,
const null_type  
)

Definition at line 404 of file fwd.hpp.

409{

◆ minus() [2/12]

template<typename Up >
null_type & tim::math::minus ( null_type lhs,
Up &&   
)

Definition at line 404 of file fwd.hpp.

409{

◆ minus() [3/12]

std::tuple & tim::math::minus ( std::tuple<> &  lhs,
const std::tuple<> &   
)

Definition at line 403 of file fwd.hpp.

409{

◆ minus() [4/12]

template<typename Up >
std::tuple & tim::math::minus ( std::tuple<> &  lhs,
Up &&   
)

Definition at line 403 of file fwd.hpp.

409{

◆ minus() [5/12]

template<typename Tp , typename Up = Tp, enable_if_t<!concepts::is_null_type< Tp >::value > = 0>
Tp & tim::math::minus ( Tp &  _lhs,
const Up &  _rhs 
)

Definition at line 98 of file minus.hpp.

99{
100 minus(_lhs, _rhs, get_index_sequence<Tp>::value, 0);
101 return _lhs;
102}
auto minus(Tp &_lhs, const Up &_rhs, index_sequence< Idx... >, long) -> decltype(std::get< 0 >(_lhs), void())
Definition: minus.hpp:89

References minus().

Referenced by tim::data::handler< V, Tag >::end(), minus(), tim::mpl::apply< void >::minus(), and tim::component::operators::operator-().

◆ minus() [6/12]

template<typename Tp , typename Up >
auto tim::math::minus ( Tp &  ,
const Up &  ,
index_sequence<>  ,
int   
)

Definition at line 84 of file minus.hpp.

85{}

◆ minus() [7/12]

template<typename Tp , typename Up , size_t... Idx>
auto tim::math::minus ( Tp &  _lhs,
const Up &  _rhs,
index_sequence< Idx... >  ,
long   
) -> decltype(std::get<0>(_lhs), void())

Definition at line 89 of file minus.hpp.

91{
92 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
93 TIMEMORY_FOLD_EXPRESSION(minus(std::get<Idx>(_lhs), std::get<Idx>(_rhs)));
94}

References minus(), and TIMEMORY_FOLD_EXPRESSION.

◆ minus() [8/12]

template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto tim::math::minus ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
int   
) -> decltype(std::begin(_lhs), void())

Definition at line 69 of file minus.hpp.

70{
71 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
72
73 for(auto litr = std::begin(_lhs); litr != std::end(_lhs); ++litr)
74 {
75 auto ritr = _rhs.find(litr->first);
76 if(ritr == std::end(_rhs))
77 continue;
78 minus(litr->second, ritr->second);
79 }
80}

References minus().

◆ minus() [9/12]

template<typename Tp , typename Up , typename Vp = typename Tp::value_type>
auto tim::math::minus ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
long   
) -> decltype(std::begin(_lhs), void())

Definition at line 51 of file minus.hpp.

52{
53 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
54 auto _n = mpl::get_size(_rhs);
55 if(mpl::get_size(_lhs) < _n)
56 mpl::resize(_lhs, _n);
57
58 for(decltype(_n) i = 0; i < _n; ++i)
59 {
60 auto litr = std::begin(_lhs) + i;
61 auto ritr = std::begin(_rhs) + i;
62 minus(*litr, *ritr);
63 }
64}

References tim::mpl::get_size(), minus(), and tim::mpl::resize().

◆ minus() [10/12]

template<typename Tp , typename Up >
auto tim::math::minus ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
  ... 
) -> decltype(_lhs -= _rhs, void())

Definition at line 43 of file minus.hpp.

44{
45 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
46 _lhs -= _rhs;
47}

◆ minus() [11/12]

type_list & tim::math::minus ( type_list<> &  lhs,
const type_list<> &   
)

Definition at line 405 of file fwd.hpp.

409{

◆ minus() [12/12]

template<typename Up >
type_list & tim::math::minus ( type_list<> &  lhs,
Up &&   
)

Definition at line 405 of file fwd.hpp.

409{

◆ multiply() [1/13]

null_type & tim::math::multiply ( null_type lhs,
const null_type  
)

Definition at line 404 of file fwd.hpp.

409{

◆ multiply() [2/13]

template<typename Up >
null_type & tim::math::multiply ( null_type lhs,
Up &&   
)

Definition at line 404 of file fwd.hpp.

409{

◆ multiply() [3/13]

std::tuple & tim::math::multiply ( std::tuple<> &  lhs,
const std::tuple<> &   
)

Definition at line 403 of file fwd.hpp.

409{

◆ multiply() [4/13]

template<typename Up >
std::tuple & tim::math::multiply ( std::tuple<> &  lhs,
Up &&   
)

Definition at line 403 of file fwd.hpp.

409{

◆ multiply() [5/13]

template<typename Tp , typename Up = Tp, enable_if_t<!concepts::is_null_type< Tp >::value > = 0>
Tp & tim::math::multiply ( Tp &  _lhs,
const Up &  _rhs 
)

Definition at line 140 of file multiply.hpp.

141{
143 return _lhs;
144}
auto multiply(Tp &_lhs, const Up &_rhs, index_sequence< Idx... >, long) -> decltype(std::get< 0 >(_lhs), void())
Definition: multiply.hpp:121

References multiply().

Referenced by multiply().

◆ multiply() [6/13]

template<typename Tp , typename Up >
auto tim::math::multiply ( Tp &  ,
const Up &  ,
index_sequence<>  ,
int   
)

Definition at line 115 of file multiply.hpp.

116{}

◆ multiply() [7/13]

template<typename Tp , typename Up , size_t... Idx, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto tim::math::multiply ( Tp &  _lhs,
const Up &  _rhs,
index_sequence< Idx... >  ,
long   
) -> decltype(std::get<0>(_lhs), void())

Definition at line 121 of file multiply.hpp.

123{
124 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
125 TIMEMORY_FOLD_EXPRESSION(multiply(std::get<Idx>(_lhs), std::get<Idx>(_rhs)));
126}

References multiply(), and TIMEMORY_FOLD_EXPRESSION.

◆ multiply() [8/13]

template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type, enable_if_t<!std::is_arithmetic< Up >::value > = 0>
auto tim::math::multiply ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
int   
) -> decltype(std::begin(_lhs), void())

Definition at line 86 of file multiply.hpp.

87{
88 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
89
90 for(auto litr = std::begin(_lhs); litr != std::end(_lhs); ++litr)
91 {
92 auto ritr = _rhs.find(litr->first);
93 if(ritr == std::end(_rhs))
94 continue;
95 multiply(litr->second, ritr->second);
96 }
97}

References multiply().

◆ multiply() [9/13]

template<typename Tp , typename Up , typename Vp = typename Tp::value_type>
auto tim::math::multiply ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
long   
) -> decltype((std::begin(_lhs), std::begin(_rhs)), void())

Definition at line 51 of file multiply.hpp.

53{
54 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
55 auto _n = mpl::get_size(_rhs);
56 if(mpl::get_size(_lhs) < _n)
57 mpl::resize(_lhs, _n);
58
59 for(decltype(_n) i = 0; i < _n; ++i)
60 {
61 auto litr = std::begin(_lhs) + i;
62 auto ritr = std::begin(_rhs) + i;
63 multiply(*litr, *ritr);
64 }
65}

References tim::mpl::get_size(), multiply(), and tim::mpl::resize().

◆ multiply() [10/13]

template<typename Tp , typename Up , typename Vp = typename Tp::value_type, enable_if_t< std::is_arithmetic< Up >::value > = 0>
auto tim::math::multiply ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
long   
) -> decltype(std::begin(_lhs), void())

Definition at line 70 of file multiply.hpp.

72{
73 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
74 auto _n = mpl::get_size(_lhs);
75 for(decltype(_n) i = 0; i < _n; ++i)
76 {
77 auto litr = std::begin(_lhs) + i;
78 multiply(*litr, _rhs);
79 }
80}

References tim::mpl::get_size(), and multiply().

◆ multiply() [11/13]

template<typename Tp , typename Up >
auto tim::math::multiply ( Tp &  _lhs,
Up  _rhs,
type_list<>  ,
  ... 
) -> decltype(_lhs *= _rhs, void())

Definition at line 43 of file multiply.hpp.

44{
45 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
46 _lhs *= _rhs;
47}

◆ multiply() [12/13]

type_list & tim::math::multiply ( type_list<> &  lhs,
const type_list<> &   
)

Definition at line 405 of file fwd.hpp.

409{

◆ multiply() [13/13]

template<typename Up >
type_list & tim::math::multiply ( type_list<> &  lhs,
Up &&   
)

Definition at line 405 of file fwd.hpp.

409{

◆ percent_diff() [1/9]

null_type tim::math::percent_diff ( const null_type ,
const null_type  
)

Definition at line 404 of file fwd.hpp.

409{

◆ percent_diff() [2/9]

std::tuple tim::math::percent_diff ( const std::tuple<> &  ,
const std::tuple<> &   
)

Definition at line 403 of file fwd.hpp.

409{

◆ percent_diff() [3/9]

template<typename Tp >
Tp tim::math::percent_diff ( const Tp &  _lhs,
const Tp &  _rhs 
)

Definition at line 124 of file percent_diff.hpp.

125{
126 return percent_diff(_lhs, _rhs, get_index_sequence<Tp>::value, 0);
127}
auto percent_diff(const Tp &_lhs, const Tp &_rhs, index_sequence< Idx... >,...) -> decltype(std::get< 0 >(_lhs), Tp{})

References percent_diff().

Referenced by percent_diff(), and tim::operation::finalize::print< Tp, true >::write_stream().

◆ percent_diff() [4/9]

template<typename Tp , size_t... Idx>
auto tim::math::percent_diff ( const Tp &  _lhs,
const Tp &  _rhs,
index_sequence< Idx... >  ,
  ... 
) -> decltype(std::get<0>(_lhs), Tp{})

Definition at line 113 of file percent_diff.hpp.

114 {})
115{
116 Tp _ret{};
117 TIMEMORY_FOLD_EXPRESSION(std::get<Idx>(_ret) =
118 percent_diff(std::get<Idx>(_lhs), std::get<Idx>(_rhs)));
119 return _ret;
120}

◆ percent_diff() [5/9]

template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto tim::math::percent_diff ( const Tp &  _lhs,
const Tp &  _rhs,
type_list<>  ,
int   
) -> decltype(std::begin(_lhs), Tp{})

Definition at line 91 of file percent_diff.hpp.

92 {})
93{
94 assert(_lhs.size() == _rhs.size());
95 Tp _ret{};
96 for(auto litr = std::begin(_lhs); litr != std::end(_lhs); ++litr)
97 {
98 auto ritr = _rhs.find(litr->first);
99 if(ritr == std::end(_rhs))
100 {
101 _ret[litr->first] = Mp{};
102 }
103 else
104 {
105 _ret[litr->first] = percent_diff(litr->second, ritr->second);
106 }
107 }
108 return _ret;
109}

◆ percent_diff() [6/9]

template<typename Tp , typename Vp = typename Tp::value_type>
auto tim::math::percent_diff ( const Tp &  _lhs,
const Tp &  _rhs,
type_list<>  ,
long   
) -> decltype(std::begin(_lhs), Tp{})

Definition at line 62 of file percent_diff.hpp.

63 {})
64{
65 auto _nl = mpl::get_size(_lhs);
66 auto _nr = mpl::get_size(_rhs);
67 using Int_t = decltype(_nl);
68
69 auto _n = std::min<Int_t>(_nl, _nr);
70 Tp _ret{};
71 mpl::resize(_ret, _n);
72
73 // initialize
74 for(auto& itr : _ret)
75 itr = Vp{};
76
77 // compute
78 for(Int_t i = 0; i < _n; ++i)
79 {
80 auto litr = std::begin(_lhs) + i;
81 auto ritr = std::begin(_rhs) + i;
82 auto itr = std::begin(_ret) + i;
83 *itr = percent_diff(*litr, *ritr);
84 }
85 return _ret;
86}

◆ percent_diff() [7/9]

type_list tim::math::percent_diff ( const type_list<> &  ,
const type_list<> &   
)

Definition at line 405 of file fwd.hpp.

409{

◆ percent_diff() [8/9]

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
Tp tim::math::percent_diff ( Tp  _lhs,
Tp  _rhs,
type_list<>  ,
  ... 
)

Definition at line 43 of file percent_diff.hpp.

44{
45 constexpr Tp _zero = Tp(0.0);
46 constexpr Tp _one = Tp(1.0);
47 constexpr Tp _hundred = Tp(100.0);
48 Tp&& _pdiff = (_rhs > _zero) ? ((_one - (_lhs / _rhs)) * _hundred) : _zero;
49 return (_pdiff < _zero) ? _zero : _pdiff;
50}

◆ percent_diff() [9/9]

template<typename Tp , enable_if_t<!std::is_arithmetic< Tp >::value &&std::is_class< Tp >::value > = 0>
auto tim::math::percent_diff ( Tp  _lhs,
Tp  _rhs,
type_list<>  ,
  ... 
) -> decltype(_lhs.percent_diff(_rhs))

Definition at line 55 of file percent_diff.hpp.

56{
57 return _lhs.percent_diff(_rhs);
58}

◆ plus() [1/12]

null_type & tim::math::plus ( null_type lhs,
const null_type  
)

Definition at line 404 of file fwd.hpp.

409{

◆ plus() [2/12]

template<typename Up >
null_type & tim::math::plus ( null_type lhs,
Up &&   
)

Definition at line 404 of file fwd.hpp.

409{

◆ plus() [3/12]

std::tuple & tim::math::plus ( std::tuple<> &  lhs,
const std::tuple<> &   
)

Definition at line 403 of file fwd.hpp.

409{

◆ plus() [4/12]

template<typename Up >
std::tuple & tim::math::plus ( std::tuple<> &  lhs,
Up &&   
)

Definition at line 403 of file fwd.hpp.

409{

◆ plus() [5/12]

template<typename Tp , typename Up = Tp, enable_if_t<!concepts::is_null_type< Tp >::value > = 0>
Tp & tim::math::plus ( Tp &  _lhs,
const Up &  _rhs 
)

Definition at line 106 of file plus.hpp.

107{
108 plus(_lhs, _rhs, get_index_sequence<Tp>::value, 0);
109 return _lhs;
110}
auto plus(Tp &_lhs, const Up &_rhs, index_sequence< Idx... >, long) -> decltype(std::get< 0 >(_lhs), void())
Definition: plus.hpp:97

References plus().

Referenced by plus(), tim::mpl::apply< void >::plus(), and tim::operation::finalize::print< Tp, true >::write_stream().

◆ plus() [6/12]

template<typename Tp , typename Up >
auto tim::math::plus ( Tp &  ,
const Up &  ,
index_sequence<>  ,
int   
)

Definition at line 92 of file plus.hpp.

93{}

◆ plus() [7/12]

template<typename Tp , typename Up , size_t... Idx>
auto tim::math::plus ( Tp &  _lhs,
const Up &  _rhs,
index_sequence< Idx... >  ,
long   
) -> decltype(std::get<0>(_lhs), void())

Definition at line 97 of file plus.hpp.

99{
100 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
101 TIMEMORY_FOLD_EXPRESSION(plus(std::get<Idx>(_lhs), std::get<Idx>(_rhs)));
102}

References plus(), and TIMEMORY_FOLD_EXPRESSION.

◆ plus() [8/12]

template<typename Tp , typename Up , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto tim::math::plus ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
int   
) -> decltype(std::begin(_lhs), void())

Definition at line 69 of file plus.hpp.

70{
71 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
72
73 for(auto litr = std::begin(_lhs); litr != std::end(_lhs); ++litr)
74 {
75 auto ritr = _rhs.find(litr->first);
76 if(ritr == std::end(_rhs))
77 continue;
78 plus(litr->second, ritr->second);
79 }
80
81 for(auto ritr = std::begin(_rhs); ritr != std::end(_rhs); ++ritr)
82 {
83 auto litr = _lhs.find(ritr->first);
84 if(litr == std::end(_lhs))
85 continue;
86 _lhs[ritr->first] = ritr->second;
87 }
88}

References plus().

◆ plus() [9/12]

template<typename Tp , typename Up , typename Vp = typename Tp::value_type>
auto tim::math::plus ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
long   
) -> decltype(std::begin(_lhs), void())

Definition at line 51 of file plus.hpp.

52{
53 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
54 auto _n = mpl::get_size(_rhs);
55 if(mpl::get_size(_lhs) < _n)
56 mpl::resize(_lhs, _n);
57
58 for(decltype(_n) i = 0; i < _n; ++i)
59 {
60 auto litr = std::begin(_lhs) + i;
61 auto ritr = std::begin(_rhs) + i;
62 plus(*litr, *ritr);
63 }
64}

References tim::mpl::get_size(), plus(), and tim::mpl::resize().

◆ plus() [10/12]

template<typename Tp , typename Up >
auto tim::math::plus ( Tp &  _lhs,
const Up &  _rhs,
type_list<>  ,
  ... 
) -> decltype(_lhs += _rhs, void())

Definition at line 43 of file plus.hpp.

44{
45 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
46 _lhs += _rhs;
47}

◆ plus() [11/12]

type_list & tim::math::plus ( type_list<> &  lhs,
const type_list<> &   
)

Definition at line 405 of file fwd.hpp.

409{

◆ plus() [12/12]

template<typename Up >
type_list & tim::math::plus ( type_list<> &  lhs,
Up &&   
)

Definition at line 405 of file fwd.hpp.

409{

◆ pow() [1/8]

null_type tim::math::pow ( null_type  ,
double   
)

Definition at line 404 of file fwd.hpp.

409{

◆ pow() [2/8]

std::tuple tim::math::pow ( std::tuple<>  ,
double   
)

Definition at line 403 of file fwd.hpp.

409{

◆ pow() [3/8]

template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto tim::math::pow ( Tp  _val,
double  _m,
type_list<>   
) -> decltype(std::begin(_val), Tp{})

Definition at line 62 of file pow.hpp.

62 {})
63{
64 for(auto& itr : _val)
65 {
66 itr.second = ::tim::math::pow(itr.second, _m);
67 }
68 return _val;
69}
auto pow(Tuple< Types... > _val, double _m, index_sequence< Idx... >) -> decltype(std::get< 0 >(_val), Tuple< Types... >())
Definition: pow.hpp:73

◆ pow() [4/8]

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
auto tim::math::pow ( Tp  _val,
double  _m,
type_list<>   
) -> decltype(std::pow(_val, _m), Tp{})

Definition at line 43 of file pow.hpp.

43 {})
44{
45 return std::pow(_val, _m);
46}

◆ pow() [5/8]

template<typename Tp , typename Vp = typename Tp::value_type>
auto tim::math::pow ( Tp  _val,
double  _m,
type_list<>  ,
  ... 
) -> decltype(std::begin(_val), Tp{})

Definition at line 50 of file pow.hpp.

50 {})
51{
52 for(auto& itr : _val)
53 {
54 itr = ::tim::math::pow(itr, _m);
55 }
56 return _val;
57}

◆ pow() [6/8]

template<typename Tp >
Tp tim::math::pow ( Tp  _val,
double  _m 
)

Definition at line 83 of file pow.hpp.

References pow().

Referenced by pow(), and sqr().

◆ pow() [7/8]

template<template< typename... > class Tuple, typename... Types, size_t... Idx>
auto tim::math::pow ( Tuple< Types... >  _val,
double  _m,
index_sequence< Idx... >   
) -> decltype(std::get<0>(_val), Tuple<Types...>())

Definition at line 73 of file pow.hpp.

75{
76 TIMEMORY_FOLD_EXPRESSION(std::get<Idx>(_val) =
77 ::tim::math::pow(std::get<Idx>(_val), _m));
78 return _val;
79}
Tp pow(Tp, double)
Definition: pow.hpp:83

References pow(), and TIMEMORY_FOLD_EXPRESSION.

Referenced by pow().

◆ pow() [8/8]

type_list tim::math::pow ( type_list<>  ,
double   
)

Definition at line 405 of file fwd.hpp.

409{

◆ sqr() [1/3]

null_type tim::math::sqr ( null_type  )

Definition at line 404 of file fwd.hpp.

409{

◆ sqr() [2/3]

std::tuple tim::math::sqr ( std::tuple<>  )

Definition at line 403 of file fwd.hpp.

409{

◆ sqr() [3/3]

template<typename Tp >
Tp tim::math::sqr ( Tp  _val)

Definition at line 43 of file sqr.hpp.

44{
45 static_assert(!concepts::is_null_type<Tp>::value, "Error! null type");
46 return ::tim::math::pow(_val, 2.0);
47}

References pow().

◆ sqrt() [1/7]

null_type tim::math::sqrt ( null_type  )

Definition at line 404 of file fwd.hpp.

409{

◆ sqrt() [2/7]

std::tuple tim::math::sqrt ( std::tuple<>  )

Definition at line 403 of file fwd.hpp.

409{

◆ sqrt() [3/7]

template<typename Tp , typename Kp = typename Tp::key_type, typename Mp = typename Tp::mapped_type>
auto tim::math::sqrt ( Tp  _val,
type_list<>   
) -> decltype(std::begin(_val), Tp{})

Definition at line 60 of file sqrt.hpp.

60 {})
61{
62 for(auto& itr : _val)
63 {
64 itr.second = ::tim::math::sqrt(itr.second);
65 }
66 return _val;
67}
auto sqrt(Tuple< Types... > _val, index_sequence< Idx... >) -> decltype(std::get< 0 >(_val), Tuple< Types... >())
Definition: sqrt.hpp:71

◆ sqrt() [4/7]

template<typename Tp , enable_if_t< std::is_arithmetic< Tp >::value > = 0>
auto tim::math::sqrt ( Tp  _val,
type_list<>   
) -> decltype(std::sqrt(_val), Tp{})

Definition at line 43 of file sqrt.hpp.

43 {})
44{
45 return std::sqrt(_val);
46}

◆ sqrt() [5/7]

template<typename Tp , typename Vp = typename Tp::value_type>
auto tim::math::sqrt ( Tp  _val,
type_list<>  ,
  ... 
) -> decltype(std::begin(_val), Tp{})

Definition at line 50 of file sqrt.hpp.

50 {})
51{
52 for(auto& itr : _val)
53 itr = ::tim::math::sqrt(itr);
54 return _val;
55}

◆ sqrt() [6/7]

template<typename Tp >
Tp tim::math::sqrt ( Tp  _val)

Definition at line 81 of file sqrt.hpp.

References sqrt().

◆ sqrt() [7/7]

template<template< typename... > class Tuple, typename... Types, size_t... Idx>
auto tim::math::sqrt ( Tuple< Types... >  _val,
index_sequence< Idx... >   
) -> decltype(std::get<0>(_val), Tuple<Types...>())

Definition at line 71 of file sqrt.hpp.

73{
74 TIMEMORY_FOLD_EXPRESSION(std::get<Idx>(_val) =
75 ::tim::math::sqrt(std::get<Idx>(_val)));
76 return _val;
77}
type_list sqrt(type_list<>)
Definition: fwd.hpp:405

References sqrt, and TIMEMORY_FOLD_EXPRESSION.

Referenced by sqrt().

Variable Documentation

◆ abs

◆ sqr

type_list tim::math::sqr(type_list<>) ( type_list<>  )

Definition at line 405 of file fwd.hpp.

409{

◆ sqrt

type_list tim::math::sqrt(type_list<>) ( type_list<>  )

Definition at line 405 of file fwd.hpp.

409{

Referenced by sqrt().