functional.hpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2013 Kyle Lutz <[email protected]>
  3. //
  4. // Distributed under the Boost Software License, Version 1.0
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. //
  8. // See http://boostorg.github.com/compute for more information.
  9. //---------------------------------------------------------------------------//
  10. #ifndef BOOST_COMPUTE_LAMBDA_FUNCTIONAL_HPP
  11. #define BOOST_COMPUTE_LAMBDA_FUNCTIONAL_HPP
  12. #include <boost/tuple/tuple.hpp>
  13. #include <boost/lexical_cast.hpp>
  14. #include <boost/proto/core.hpp>
  15. #include <boost/preprocessor/cat.hpp>
  16. #include <boost/preprocessor/stringize.hpp>
  17. #include <boost/compute/functional/get.hpp>
  18. #include <boost/compute/lambda/result_of.hpp>
  19. #include <boost/compute/lambda/placeholder.hpp>
  20. #include <boost/compute/types/fundamental.hpp>
  21. #include <boost/compute/type_traits/scalar_type.hpp>
  22. #include <boost/compute/type_traits/vector_size.hpp>
  23. #include <boost/compute/type_traits/make_vector_type.hpp>
  24. namespace boost {
  25. namespace compute {
  26. namespace lambda {
  27. namespace mpl = boost::mpl;
  28. namespace proto = boost::proto;
  29. // wraps a unary boolean function whose result type is an int_ when the argument
  30. // type is a scalar, and intN_ if the argument type is a vector of size N
  31. #define BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(name) \
  32. namespace detail { \
  33. struct BOOST_PP_CAT(name, _func) \
  34. { \
  35. template<class Expr, class Args> \
  36. struct lambda_result \
  37. { \
  38. typedef typename proto::result_of::child_c<Expr, 1>::type Arg; \
  39. typedef typename ::boost::compute::lambda::result_of<Arg, Args>::type result_type; \
  40. typedef typename ::boost::compute::make_vector_type< \
  41. ::boost::compute::int_, \
  42. ::boost::compute::vector_size<result_type>::value \
  43. >::type type; \
  44. }; \
  45. \
  46. template<class Context, class Arg> \
  47. static void apply(Context &ctx, const Arg &arg) \
  48. { \
  49. ctx.stream << #name << "("; \
  50. proto::eval(arg, ctx); \
  51. ctx.stream << ")"; \
  52. } \
  53. }; \
  54. } \
  55. template<class Arg> \
  56. inline typename proto::result_of::make_expr< \
  57. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg& \
  58. >::type const \
  59. name(const Arg &arg) \
  60. { \
  61. return proto::make_expr<proto::tag::function>( \
  62. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg) \
  63. ); \
  64. }
  65. // wraps a unary function whose return type is the same as the argument type
  66. #define BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(name) \
  67. namespace detail { \
  68. struct BOOST_PP_CAT(name, _func) \
  69. { \
  70. template<class Expr, class Args> \
  71. struct lambda_result \
  72. { \
  73. typedef typename proto::result_of::child_c<Expr, 1>::type Arg1; \
  74. typedef typename ::boost::compute::lambda::result_of<Arg1, Args>::type type; \
  75. }; \
  76. \
  77. template<class Context, class Arg> \
  78. static void apply(Context &ctx, const Arg &arg) \
  79. { \
  80. ctx.stream << #name << "("; \
  81. proto::eval(arg, ctx); \
  82. ctx.stream << ")"; \
  83. } \
  84. }; \
  85. } \
  86. template<class Arg> \
  87. inline typename proto::result_of::make_expr< \
  88. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg& \
  89. >::type const \
  90. name(const Arg &arg) \
  91. { \
  92. return proto::make_expr<proto::tag::function>( \
  93. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg) \
  94. ); \
  95. }
  96. // wraps a unary function whose result type is the scalar type of the first argument
  97. #define BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_ST(name) \
  98. namespace detail { \
  99. struct BOOST_PP_CAT(name, _func) \
  100. { \
  101. template<class Expr, class Args> \
  102. struct lambda_result \
  103. { \
  104. typedef typename proto::result_of::child_c<Expr, 1>::type Arg; \
  105. typedef typename ::boost::compute::lambda::result_of<Arg, Args>::type result_type; \
  106. typedef typename ::boost::compute::scalar_type<result_type>::type type; \
  107. }; \
  108. \
  109. template<class Context, class Arg> \
  110. static void apply(Context &ctx, const Arg &arg) \
  111. { \
  112. ctx.stream << #name << "("; \
  113. proto::eval(arg, ctx); \
  114. ctx.stream << ")"; \
  115. } \
  116. }; \
  117. } \
  118. template<class Arg> \
  119. inline typename proto::result_of::make_expr< \
  120. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg& \
  121. >::type const \
  122. name(const Arg &arg) \
  123. { \
  124. return proto::make_expr<proto::tag::function>( \
  125. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg) \
  126. ); \
  127. }
  128. // wraps a binary boolean function whose result type is an int_ when the first
  129. // argument type is a scalar, and intN_ if the first argument type is a vector
  130. // of size N
  131. #define BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(name) \
  132. namespace detail { \
  133. struct BOOST_PP_CAT(name, _func) \
  134. { \
  135. template<class Expr, class Args> \
  136. struct lambda_result \
  137. { \
  138. typedef typename proto::result_of::child_c<Expr, 1>::type Arg1; \
  139. typedef typename ::boost::compute::make_vector_type< \
  140. ::boost::compute::int_, \
  141. ::boost::compute::vector_size<Arg1>::value \
  142. >::type type; \
  143. }; \
  144. \
  145. template<class Context, class Arg1, class Arg2> \
  146. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) \
  147. { \
  148. ctx.stream << #name << "("; \
  149. proto::eval(arg1, ctx); \
  150. ctx.stream << ", "; \
  151. proto::eval(arg2, ctx); \
  152. ctx.stream << ")"; \
  153. } \
  154. }; \
  155. } \
  156. template<class Arg1, class Arg2> \
  157. inline typename proto::result_of::make_expr< \
  158. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2& \
  159. >::type const \
  160. name(const Arg1 &arg1, const Arg2 &arg2) \
  161. { \
  162. return proto::make_expr<proto::tag::function>( \
  163. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2) \
  164. ); \
  165. }
  166. // wraps a binary function whose result type is the type of the first argument
  167. #define BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(name) \
  168. namespace detail { \
  169. struct BOOST_PP_CAT(name, _func) \
  170. { \
  171. template<class Expr, class Args> \
  172. struct lambda_result \
  173. { \
  174. typedef typename proto::result_of::child_c<Expr, 1>::type Arg1; \
  175. typedef typename ::boost::compute::lambda::result_of<Arg1, Args>::type type; \
  176. }; \
  177. \
  178. template<class Context, class Arg1, class Arg2> \
  179. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) \
  180. { \
  181. ctx.stream << #name << "("; \
  182. proto::eval(arg1, ctx); \
  183. ctx.stream << ", "; \
  184. proto::eval(arg2, ctx); \
  185. ctx.stream << ")"; \
  186. } \
  187. }; \
  188. } \
  189. template<class Arg1, class Arg2> \
  190. inline typename proto::result_of::make_expr< \
  191. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2& \
  192. >::type const \
  193. name(const Arg1 &arg1, const Arg2 &arg2) \
  194. { \
  195. return proto::make_expr<proto::tag::function>( \
  196. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2) \
  197. ); \
  198. }
  199. // wraps a binary function whose result type is the type of the second argument
  200. #define BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_2(name) \
  201. namespace detail { \
  202. struct BOOST_PP_CAT(name, _func) \
  203. { \
  204. template<class Expr, class Args> \
  205. struct lambda_result \
  206. { \
  207. typedef typename proto::result_of::child_c<Expr, 2>::type Arg2; \
  208. typedef typename ::boost::compute::lambda::result_of<Arg2, Args>::type type; \
  209. }; \
  210. \
  211. template<class Context, class Arg1, class Arg2> \
  212. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) \
  213. { \
  214. ctx.stream << #name << "("; \
  215. proto::eval(arg1, ctx); \
  216. ctx.stream << ", "; \
  217. proto::eval(arg2, ctx); \
  218. ctx.stream << ")"; \
  219. } \
  220. }; \
  221. } \
  222. template<class Arg1, class Arg2> \
  223. inline typename proto::result_of::make_expr< \
  224. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2& \
  225. >::type const \
  226. name(const Arg1 &arg1, const Arg2 &arg2) \
  227. { \
  228. return proto::make_expr<proto::tag::function>( \
  229. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2) \
  230. ); \
  231. }
  232. // wraps a binary function who's result type is the scalar type of the first argument
  233. #define BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_ST(name) \
  234. namespace detail { \
  235. struct BOOST_PP_CAT(name, _func) \
  236. { \
  237. template<class Expr, class Args> \
  238. struct lambda_result \
  239. { \
  240. typedef typename proto::result_of::child_c<Expr, 1>::type Arg1; \
  241. typedef typename ::boost::compute::lambda::result_of<Arg1, Args>::type result_type; \
  242. typedef typename ::boost::compute::scalar_type<result_type>::type type; \
  243. }; \
  244. \
  245. template<class Context, class Arg1, class Arg2> \
  246. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) \
  247. { \
  248. ctx.stream << #name << "("; \
  249. proto::eval(arg1, ctx); \
  250. ctx.stream << ", "; \
  251. proto::eval(arg2, ctx); \
  252. ctx.stream << ")"; \
  253. } \
  254. }; \
  255. } \
  256. template<class Arg1, class Arg2> \
  257. inline typename proto::result_of::make_expr< \
  258. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2& \
  259. >::type const \
  260. name(const Arg1 &arg1, const Arg2 &arg2) \
  261. { \
  262. return proto::make_expr<proto::tag::function>( \
  263. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2) \
  264. ); \
  265. }
  266. // wraps a binary function whose result type is the type of the first argument
  267. // and the second argument is a pointer
  268. #define BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_PTR(name) \
  269. namespace detail { \
  270. struct BOOST_PP_CAT(name, _func) \
  271. { \
  272. template<class Expr, class Args> \
  273. struct lambda_result \
  274. { \
  275. typedef typename proto::result_of::child_c<Expr, 1>::type Arg1; \
  276. typedef typename ::boost::compute::lambda::result_of<Arg1, Args>::type type; \
  277. }; \
  278. \
  279. template<class Context, class Arg1, class Arg2> \
  280. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) \
  281. { \
  282. ctx.stream << #name << "("; \
  283. proto::eval(arg1, ctx); \
  284. ctx.stream << ", &"; \
  285. proto::eval(arg2, ctx); \
  286. ctx.stream << ")"; \
  287. } \
  288. }; \
  289. } \
  290. template<class Arg1, class Arg2> \
  291. inline typename proto::result_of::make_expr< \
  292. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2& \
  293. >::type const \
  294. name(const Arg1 &arg1, const Arg2 &arg2) \
  295. { \
  296. return proto::make_expr<proto::tag::function>( \
  297. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2) \
  298. ); \
  299. }
  300. // wraps a ternary function
  301. #define BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(name) \
  302. namespace detail { \
  303. struct BOOST_PP_CAT(name, _func) \
  304. { \
  305. template<class Expr, class Args> \
  306. struct lambda_result \
  307. { \
  308. typedef typename proto::result_of::child_c<Expr, 1>::type Arg1; \
  309. typedef typename ::boost::compute::lambda::result_of<Arg1, Args>::type type; \
  310. }; \
  311. \
  312. template<class Context, class Arg1, class Arg2, class Arg3> \
  313. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \
  314. { \
  315. ctx.stream << #name << "("; \
  316. proto::eval(arg1, ctx); \
  317. ctx.stream << ", "; \
  318. proto::eval(arg2, ctx); \
  319. ctx.stream << ", "; \
  320. proto::eval(arg3, ctx); \
  321. ctx.stream << ")"; \
  322. } \
  323. }; \
  324. } \
  325. template<class Arg1, class Arg2, class Arg3> \
  326. inline typename proto::result_of::make_expr< \
  327. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2&, const Arg3& \
  328. >::type const \
  329. name(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \
  330. { \
  331. return proto::make_expr<proto::tag::function>( \
  332. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2), ::boost::ref(arg3) \
  333. ); \
  334. }
  335. // wraps a ternary function whose result type is the type of the third argument
  336. #define BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION_3(name) \
  337. namespace detail { \
  338. struct BOOST_PP_CAT(name, _func) \
  339. { \
  340. template<class Expr, class Args> \
  341. struct lambda_result \
  342. { \
  343. typedef typename proto::result_of::child_c<Expr, 3>::type Arg3; \
  344. typedef typename ::boost::compute::lambda::result_of<Arg3, Args>::type type; \
  345. }; \
  346. \
  347. template<class Context, class Arg1, class Arg2, class Arg3> \
  348. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \
  349. { \
  350. ctx.stream << #name << "("; \
  351. proto::eval(arg1, ctx); \
  352. ctx.stream << ", "; \
  353. proto::eval(arg2, ctx); \
  354. ctx.stream << ", "; \
  355. proto::eval(arg3, ctx); \
  356. ctx.stream << ")"; \
  357. } \
  358. }; \
  359. } \
  360. template<class Arg1, class Arg2, class Arg3> \
  361. inline typename proto::result_of::make_expr< \
  362. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2&, const Arg3& \
  363. >::type const \
  364. name(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \
  365. { \
  366. return proto::make_expr<proto::tag::function>( \
  367. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2), ::boost::ref(arg3) \
  368. ); \
  369. }
  370. // wraps a ternary function whose result type is the type of the first argument
  371. // and the third argument of the function is a pointer
  372. #define BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION_PTR(name) \
  373. namespace detail { \
  374. struct BOOST_PP_CAT(name, _func) \
  375. { \
  376. template<class Expr, class Args> \
  377. struct lambda_result \
  378. { \
  379. typedef typename proto::result_of::child_c<Expr, 3>::type Arg3; \
  380. typedef typename ::boost::compute::lambda::result_of<Arg3, Args>::type type; \
  381. }; \
  382. \
  383. template<class Context, class Arg1, class Arg2, class Arg3> \
  384. static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \
  385. { \
  386. ctx.stream << #name << "("; \
  387. proto::eval(arg1, ctx); \
  388. ctx.stream << ", "; \
  389. proto::eval(arg2, ctx); \
  390. ctx.stream << ", &"; \
  391. proto::eval(arg3, ctx); \
  392. ctx.stream << ")"; \
  393. } \
  394. }; \
  395. } \
  396. template<class Arg1, class Arg2, class Arg3> \
  397. inline typename proto::result_of::make_expr< \
  398. proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2&, const Arg3& \
  399. >::type const \
  400. name(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \
  401. { \
  402. return proto::make_expr<proto::tag::function>( \
  403. BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2), ::boost::ref(arg3) \
  404. ); \
  405. }
  406. // Common Built-In Functions
  407. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(clamp)
  408. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(degrees)
  409. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(min)
  410. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(max)
  411. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(mix)
  412. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(radians)
  413. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sign)
  414. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_2(step)
  415. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION_3(smoothstep)
  416. // Geometric Built-In Functions
  417. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(cross)
  418. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_ST(dot)
  419. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_ST(distance)
  420. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_ST(length)
  421. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(normalize)
  422. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_ST(fast_distance)
  423. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_ST(fast_length)
  424. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(fast_normalize)
  425. // Integer Built-In Functions
  426. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(abs)
  427. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(abs_diff)
  428. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(add_sat)
  429. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(hadd)
  430. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(rhadd)
  431. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(clz)
  432. #ifdef BOOST_COMPUTE_CL_VERSION_2_0
  433. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(ctz)
  434. #endif
  435. // clamp() (since 1.1) already defined in common
  436. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(mad_hi)
  437. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(mad24)
  438. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(mad_sat)
  439. // max() and min() functions are defined in common
  440. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(mul_hi)
  441. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(mul24)
  442. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(rotate)
  443. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(sub_sat)
  444. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(upsample)
  445. #ifdef BOOST_COMPUTE_CL_VERSION_1_2
  446. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(popcount)
  447. #endif
  448. // Math Built-In Functions
  449. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(acos)
  450. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(acosh)
  451. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(acospi)
  452. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(asin)
  453. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(asinh)
  454. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(asinpi)
  455. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(atan)
  456. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(atan2)
  457. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(atanh)
  458. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(atanpi)
  459. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(atan2pi)
  460. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(cbrt)
  461. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(ceil)
  462. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(copysign)
  463. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(cos)
  464. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(cosh)
  465. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(cospi)
  466. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(erfc)
  467. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(erf)
  468. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(exp)
  469. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(exp2)
  470. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(exp10)
  471. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(expm1)
  472. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(fabs)
  473. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(fdim)
  474. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(floor)
  475. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(fma)
  476. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(fmax)
  477. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(fmin)
  478. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(fmod)
  479. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_PTR(fract)
  480. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_PTR(frexp)
  481. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(hypot)
  482. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(ilogb) // ilogb returns intN_
  483. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(ldexp)
  484. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(lgamma)
  485. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_PTR(lgamma_r)
  486. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(log)
  487. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(log2)
  488. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(log10)
  489. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(log1p)
  490. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(logb)
  491. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(mad)
  492. #ifdef BOOST_COMPUTE_CL_VERSION_1_1
  493. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(maxmag)
  494. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(minmag)
  495. #endif
  496. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_PTR(modf)
  497. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(nan)
  498. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(nextafter)
  499. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(pow)
  500. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(pown)
  501. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(powr)
  502. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(remainder)
  503. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION_PTR(remquo)
  504. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(rint)
  505. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(rootn)
  506. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(round)
  507. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(rsqrt)
  508. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sin)
  509. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sincos)
  510. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sinh)
  511. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sinpi)
  512. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sqrt)
  513. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(tan)
  514. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(tanh)
  515. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(tanpi)
  516. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(tgamma)
  517. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(trunc)
  518. // Native Math Built-In Functions
  519. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_cos)
  520. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(native_divide)
  521. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_exp)
  522. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_exp2)
  523. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_exp10)
  524. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_log)
  525. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_log2)
  526. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_log10)
  527. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(native_powr)
  528. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_recip)
  529. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_rsqrt)
  530. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_sin)
  531. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_sqrt)
  532. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(native_tan)
  533. // Half Math Built-In Functions
  534. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_cos)
  535. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(half_divide)
  536. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_exp)
  537. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_exp2)
  538. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_exp10)
  539. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_log)
  540. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_log2)
  541. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_log10)
  542. BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(half_powr)
  543. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_recip)
  544. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_rsqrt)
  545. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_sin)
  546. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_sqrt)
  547. BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(half_tan)
  548. // Relational Built-In Functions
  549. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(isequal)
  550. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(isnotequal)
  551. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(isgreater)
  552. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(isgreaterequal)
  553. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(isless)
  554. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(islessequal)
  555. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(islessgreater)
  556. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(isfinite)
  557. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(isinf)
  558. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(isnan)
  559. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(isnormal)
  560. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(isordered)
  561. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_BINARY_FUNCTION(isunordered)
  562. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(singbit)
  563. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(all)
  564. BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(any)
  565. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(bitselect)
  566. BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(select)
  567. } // end lambda namespace
  568. } // end compute namespace
  569. } // end boost namespace
  570. #endif // BOOST_COMPUTE_LAMBDA_FUNCTIONAL_HPP