19 #include <boost/mpl/list.hpp> 20 #include <boost/mpl/int.hpp> 22 #ifndef ISAAC_FUNCTOR_LENGTH_ENABLED 23 #define ISAAC_FUNCTOR_LENGTH_ENABLED 1 25 #ifndef ISAAC_FUNCTOR_MUL_ENABLED 26 #define ISAAC_FUNCTOR_MUL_ENABLED 1 28 #ifndef ISAAC_FUNCTOR_ADD_ENABLED 29 #define ISAAC_FUNCTOR_ADD_ENABLED 1 31 #ifndef ISAAC_FUNCTOR_POW_ENABLED 32 #define ISAAC_FUNCTOR_POW_ENABLED 1 34 #ifndef ISAAC_FUNCTOR_SUM_ENABLED 35 #define ISAAC_FUNCTOR_SUM_ENABLED 1 41 namespace fus = boost::fusion;
42 namespace mpl = boost::mpl;
47 static const std::string
name;
50 static isaac_float_dim<4>
call(
const isaac_float_dim<4> v,
const isaac_float4& p)
55 static isaac_float_dim<3>
call(
const isaac_float_dim<3> v,
const isaac_float4& p)
60 static isaac_float_dim<2>
call(
const isaac_float_dim<2> v,
const isaac_float4& p)
65 static isaac_float_dim<1>
call(
const isaac_float_dim<1> v,
const isaac_float4& p)
72 return std::string(
"idem");
77 return std::string(
"Does nothing. Keeps the feature dimension.");
81 #if ISAAC_FUNCTOR_LENGTH_ENABLED == 1 85 static const std::string
name;
89 #pragma GCC diagnostic push 90 #pragma GCC diagnostic ignored "-Wnarrowing" 93 static isaac_float_dim<1>
call(
const isaac_float_dim<4> v,
const isaac_float4& p)
95 isaac_float_dim<1> result =
98 v.value.x * v.value.x +
99 v.value.y * v.value.y +
100 v.value.z * v.value.z +
101 v.value.w * v.value.w
107 static isaac_float_dim<1>
call(
const isaac_float_dim<3> v,
const isaac_float4& p)
109 isaac_float_dim<1> result =
112 v.value.x * v.value.x +
113 v.value.y * v.value.y +
114 v.value.z * v.value.z
120 static isaac_float_dim<1>
call(
const isaac_float_dim<2> v,
const isaac_float4& p)
122 isaac_float_dim<1> result =
125 v.value.x * v.value.x +
126 v.value.y * v.value.y
132 static isaac_float_dim<1>
call(
const isaac_float_dim<1> v,
const isaac_float4& p)
134 isaac_float_dim<1> result = { fabs( v.value.x ) };
138 #pragma GCC diagnostics pop 143 return std::string(
"length");
148 return std::string(
"Calculates the length of an input. Reduces the feature dimension to 1.");
153 #if ISAAC_FUNCTOR_MUL_ENABLED == 1 160 static isaac_float_dim<4>
call(
const isaac_float_dim<4> v,
const isaac_float4& p)
162 isaac_float_dim<4> result = { v.value * p };
166 static isaac_float_dim<3>
call(
const isaac_float_dim<3> v,
const isaac_float4& p)
168 isaac_float_dim<3> result =
177 static isaac_float_dim<2>
call(
const isaac_float_dim<2> v,
const isaac_float4& p)
179 isaac_float_dim<2> result =
187 static isaac_float_dim<1>
call(
const isaac_float_dim<1> v,
const isaac_float4& p)
189 isaac_float_dim<1> result = { v.value.x * p.x };
195 return std::string(
"mul");
200 return std::string(
"Multiplies the input with a constant parameter. Keeps the feature dimension.");
205 #if ISAAC_FUNCTOR_ADD_ENABLED == 1 212 static isaac_float_dim<4>
call(
const isaac_float_dim<4> v,
const isaac_float4& p)
214 isaac_float_dim<4> result = { v.value + p };
218 static isaac_float_dim<3>
call(
const isaac_float_dim<3> v,
const isaac_float4& p)
220 isaac_float_dim<3> result =
229 static isaac_float_dim<2>
call(
const isaac_float_dim<2> v,
const isaac_float4& p)
231 isaac_float_dim<2> result =
239 static isaac_float_dim<1>
call(
const isaac_float_dim<1> v,
const isaac_float4& p)
241 isaac_float_dim<1> result = { v.value.x + p.x };
247 return std::string(
"add");
252 return std::string(
"Summarizes the input with a constant parameter. Keeps the feature dimension.");
257 #if ISAAC_FUNCTOR_POW_ENABLED == 1 264 static isaac_float_dim<4>
call(
const isaac_float_dim<4> v,
const isaac_float4& p)
266 isaac_float_dim<4> result =
268 pow( v.value.x, p.x ),
269 pow( v.value.y, p.y ),
270 pow( v.value.z, p.z ),
271 pow( v.value.w, p.w )
276 static isaac_float_dim<3>
call(
const isaac_float_dim<3> v,
const isaac_float4& p)
278 isaac_float_dim<3> result =
280 pow( v.value.x, p.x ),
281 pow( v.value.y, p.y ),
282 pow( v.value.z, p.z )
287 static isaac_float_dim<2>
call(
const isaac_float_dim<2> v,
const isaac_float4& p)
289 isaac_float_dim<2> result =
291 pow( v.value.x, p.x ),
292 pow( v.value.y, p.y )
297 static isaac_float_dim<1>
call(
const isaac_float_dim<1> v,
const isaac_float4& p)
299 isaac_float_dim<1> result = { pow( v.value.x, p.x ) };
305 return std::string(
"pow");
310 return std::string(
"Calculates the power of the input with a constant exponent. Keeps the feature dimension.");
315 #if ISAAC_FUNCTOR_SUM_ENABLED == 1 322 static isaac_float_dim<1>
call(
const isaac_float_dim<4> v,
const isaac_float4& p)
324 isaac_float_dim<1> result =
334 static isaac_float_dim<1>
call(
const isaac_float_dim<3> v,
const isaac_float4& p)
336 isaac_float_dim<1> result =
345 static isaac_float_dim<1>
call(
const isaac_float_dim<2> v,
const isaac_float4& p)
347 isaac_float_dim<1> result =
355 static isaac_float_dim<1>
call(
const isaac_float_dim<1> v,
const isaac_float4& p)
357 isaac_float_dim<1> result = { v.value.x };
363 return std::string(
"sum");
368 return std::string(
"Calculates the sum of all components. Reduces the feature dimension to 1.");
375 #if ISAAC_FUNCTOR_ADD_ENABLED == 1 378 #if ISAAC_FUNCTOR_MUL_ENABLED == 1 381 #if ISAAC_FUNCTOR_LENGTH_ENABLED == 1 384 #if ISAAC_FUNCTOR_POW_ENABLED == 1 387 #if ISAAC_FUNCTOR_SUM_ENABLED == 1 392 #define ISAAC_FUNCTOR_COUNT \ 393 BOOST_PP_ADD( BOOST_PP_IF( ISAAC_FUNCTOR_ADD_ENABLED, 1, 0 ), \ 394 BOOST_PP_ADD( BOOST_PP_IF( ISAAC_FUNCTOR_MUL_ENABLED, 1, 0 ), \ 395 BOOST_PP_ADD( BOOST_PP_IF( ISAAC_FUNCTOR_LENGTH_ENABLED, 1, 0 ), \ 396 BOOST_PP_ADD( BOOST_PP_IF( ISAAC_FUNCTOR_POW_ENABLED, 1, 0 ), \ 397 BOOST_PP_ADD( BOOST_PP_IF( ISAAC_FUNCTOR_SUM_ENABLED, 1, 0 ), \ #define ISAAC_HOST_INLINE
static const std::string name
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 3 > call(const isaac_float_dim< 3 > v, const isaac_float4 &p)
static ISAAC_HOST_INLINE std::string getName()
static ISAAC_HOST_INLINE std::string getName()
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 4 > call(const isaac_float_dim< 4 > v, const isaac_float4 &p)
static ISAAC_HOST_INLINE std::string getName()
static const std::string description
static const std::string description
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 1 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 4 > call(const isaac_float_dim< 4 > v, const isaac_float4 &p)
static const std::string name
static const std::string name
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 1 > v, const isaac_float4 &p)
static const bool uses_parameter
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 2 > call(const isaac_float_dim< 2 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 1 > v, const isaac_float4 &p)
fus::list< IsaacFunctorIdem,IsaacFunctorAdd,IsaacFunctorMul,IsaacFunctorLength,IsaacFunctorPow,IsaacFunctorSum > IsaacFunctorPool
static ISAAC_HOST_INLINE std::string getDescription()
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 3 > call(const isaac_float_dim< 3 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 2 > call(const isaac_float_dim< 2 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 4 > v, const isaac_float4 &p)
static ISAAC_HOST_INLINE std::string getDescription()
static ISAAC_HOST_INLINE std::string getName()
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 2 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 3 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 4 > v, const isaac_float4 &p)
static const std::string description
#define ISAAC_HOST_DEVICE_INLINE
static ISAAC_HOST_INLINE std::string getName()
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 3 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 2 > v, const isaac_float4 &p)
static const std::string description
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 1 > v, const isaac_float4 &p)
static const std::string description
static const std::string name
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 2 > call(const isaac_float_dim< 2 > v, const isaac_float4 &p)
static const std::string description
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 1 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 4 > call(const isaac_float_dim< 4 > v, const isaac_float4 &p)
static const std::string name
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 3 > call(const isaac_float_dim< 3 > v, const isaac_float4 &p)
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 3 > call(const isaac_float_dim< 3 > v, const isaac_float4 &p)
static ISAAC_HOST_INLINE std::string getDescription()
static const std::string name
static ISAAC_HOST_INLINE std::string getName()
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 1 > call(const isaac_float_dim< 1 > v, const isaac_float4 &p)
static ISAAC_HOST_INLINE std::string getDescription()
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 4 > call(const isaac_float_dim< 4 > v, const isaac_float4 &p)
static ISAAC_HOST_INLINE std::string getDescription()
static ISAAC_HOST_INLINE std::string getDescription()
static ISAAC_HOST_DEVICE_INLINE isaac_float_dim< 2 > call(const isaac_float_dim< 2 > v, const isaac_float4 &p)