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