27 #ifndef ANTIOCH_VEXCL_UTILS_H
28 #define ANTIOCH_VEXCL_UTILS_H
30 #ifdef ANTIOCH_METAPROGRAMMING_H
31 # ifndef ANTIOCH_VEXCL_UTILS_DECL_H
32 # error valarray_utils_decl.h must be included before metaprogramming.h
41 #ifdef ANTIOCH_HAVE_VEXCL
48 #include "vexcl/vexcl.hpp"
52 template <
typename T>
class vector;
53 template <
typename T>
class is_vector_expression;
55 template<
typename real,
class RDC>
63 class get_expression_properties;
64 class extract_terminal;
69 template<
typename A0,
typename A1,
typename A2>
70 typename result_of::make_expr<
77 if_else(A0
const & a0, A1
const & a1, A2
const & a2);
83 #ifdef VEXCL_OPERATIONS_HPP
88 max(const vex::vector<T>& a,
89 const vex::vector<T>& b)
95 min(const vex::vector<T>& a,
96 const vex::vector<T>& b)
106 template <
typename T>
109 max (
const vex::vector<T>& in)
111 vex::Reductor<T, vex::MAX> vex_max(in.queue_list());
115 template <
typename T>
118 min (
const vex::vector<T>& in)
120 vex::Reductor<T, vex::MIN> vex_min(in.queue_list());
124 template <
typename T>
127 static const bool value =
true;
130 template <
typename T>
133 static const bool value =
true;
136 template <
typename T>
142 template <
typename T>
148 template <
typename T>
154 template <
typename T>
159 vex::vector<T> returnval(example.queue_list(), example.size());
164 template <
typename T1,
typename T2>
167 zero_clone(vex::vector<T1>& output,
const vex::vector<T2>& example)
169 output.resize(example.queue_list(), example.size());
173 template <
typename T,
typename Scalar>
178 vex::vector<T> returnval(example.queue_list(), example.size());
183 template <
typename T>
186 init_clone(vex::vector<T>& output,
const vex::vector<T>& example)
188 output.resize(example.queue_list(), example.size());
192 template <
typename BoolInput,
193 typename IfValue,
typename ElseValue>
195 typename boost::proto::result_of::make_expr<
196 boost::proto::tag::if_else_,
197 boost::proto::deduce_domain,
198 const vex::vector_expression<BoolInput>&,
202 if_else(
const vex::vector_expression<BoolInput> &condition,
203 const IfValue &if_true,
204 const ElseValue &if_false)
209 template <
typename T>
213 #ifdef ANTIOCH_HAVE_VEXCL
214 vex::detail::get_expression_properties prop;
215 vex::detail::extract_terminals()(boost::proto::as_child(vec_input),prop);
217 vex::any_of any_of(prop.queue);
218 return any_of(vec_input);
225 template <
typename T>
229 #ifdef ANTIOCH_HAVE_VEXCL
230 vex::detail::get_expression_properties prop;
231 vex::detail::extract_terminals()(boost::proto::as_child(vec_input),prop);
233 vex::all_of all_of(prop.queue);
234 return all_of(vec_input);
241 template <
typename VectorT,
typename IntT>
243 typename enable_if_c<
244 vex::is_vector_expression<typename value_type<VectorT>::type>::value &&
245 vex::is_vector_expression<IntT>::value,
246 typename value_type<VectorT>::type
253 for (
unsigned int i=0; i != index.size(); ++i)
254 returnval[i] = vec[index[i]][i];
263 #endif //ANTIOCH_VEXCL_UTILS_H
boost::proto::result_of::make_expr< boost::proto::tag::if_else_, boost::proto::deduce_domain, const vex::vector_expression< BoolInput > &, const IfValue &, const ElseValue & >::type const if_else(const vex::vector_expression< BoolInput > &condition, const IfValue &if_true, const ElseValue &if_false)
bool disjunction_root(const T &vec_input, vexcl_library_tag)
vex::vector< T > constant_clone(const vex::vector< T > &example, const Scalar &value)
bool conjunction_root(const T &vec_input, vexcl_library_tag)
max(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a, const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &b) ANTIOCH_AUTOFUNC(_Matrix< _Scalar ANTIOCH_COMMA _Rows ANTIOCH_COMMA _Cols ANTIOCH_COMMA _Options ANTIOCH_COMMA _MaxRows ANTIOCH_COMMA _MaxCols >
void zero_clone(vex::vector< T1 > &output, const vex::vector< T2 > &example)
raw_value_type< T >::type type
enable_if_c< vex::is_vector_expression< typename value_type< VectorT >::type >::value &&vex::is_vector_expression< IntT >::value, typename value_type< VectorT >::type >::type eval_index(const VectorT &vec, const IntT &index)
#define ANTIOCH_AUTOFUNC(Type, Expr)
The parameters are reduced parameters.
typename _Scalar int _Rows int _Cols int _Options int _MaxRows int _MaxCols inline min(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a, const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &b) ANTIOCH_AUTOFUNC(_Matrix< _Scalar ANTIOCH_COMMA _Rows ANTIOCH_COMMA _Cols ANTIOCH_COMMA _Options ANTIOCH_COMMA _MaxRows ANTIOCH_COMMA _MaxCols >
void init_clone(vex::vector< T > &output, const vex::vector< T > &example)
#define ANTIOCH_AUTO(Type)