24 #if !defined( BOLT_AMP_FUNCTIONAL_H )
25 #define BOLT_AMP_FUNCTIONAL_H
32 template<
typename Argument1,
35 :
public std::unary_function<Argument1, Result>
39 template<
typename Argument1,
43 :
public std::binary_function<Argument1, Argument2, Result>
53 T operator() (
const T& x)
const restrict(cpu,amp) {
58 template<
typename T >
61 T operator() (
const T& x)
const restrict(cpu,amp) {
return x * x * x; }
68 T operator()(
const T &__x)
const restrict(cpu,amp) {
return -__x;}
78 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs + rhs;}
84 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs - rhs;}
90 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs * rhs;}
96 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs / rhs;}
103 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return rhs > lhs ? rhs:lhs;}
109 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return rhs < lhs ? rhs:lhs;}
115 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs % rhs;}
121 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs & rhs;}
127 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs | rhs;}
133 T operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs ^ rhs;}
144 bool operator()(
const T &x)
const restrict(cpu,amp) {
return !x;}
155 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs == rhs;}
161 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs != rhs;}
167 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs > rhs;}
173 T operator()(
const T &x)
const restrict(cpu,amp) {
return x;}
179 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs < rhs;}
185 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs >= rhs;}
191 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs <= rhs;}
197 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs && rhs;}
203 bool operator()(
const T &lhs,
const T &rhs)
const restrict(cpu,amp) {
return lhs || rhs;}
207 template <
typename T>
213 bool operator() (
const T &x)
const restrict(amp,cpu)
215 T temp= _targetValue;
222 template<
typename predicate,
typename T>
225 not_pred(
const predicate &targetPred) : _targetPred(targetPred)
228 bool operator()(
const T &x)
const restrict(cpu,amp)
230 return (_targetPred(x)?
false:
true);
233 predicate _targetPred;