1 #ifndef VIENNACL_DEVICE_SPECIFIC_TEMPLATES_REDUCTION_UTILS_HPP
2 #define VIENNACL_DEVICE_SPECIFIC_TEMPLATES_REDUCTION_UTILS_HPP
37 namespace device_specific
51 os << acc <<
"= select(" << acc <<
"," << cur <<
"," << cur_value <<
">" << acc_value <<
");" << std::endl;
52 os << acc_value <<
"=";
57 os <<
"(" << acc_value <<
"," << cur_value <<
");"<< std::endl;
60 inline void process_all(std::string
const & type_key, std::string
const & str,
63 for (std::vector<mapping_type>::const_iterator mit = mappings.begin(); mit != mappings.end(); ++mit)
64 for (mapping_type::const_iterator mmit = mit->begin(); mmit != mit->end(); ++mmit)
65 if (mmit->second->type_key()==type_key)
66 stream << mmit->second->process(str) << std::endl;
70 inline void process_all_at(std::string
const & type_key, std::string
const & str,
74 for (std::vector<mapping_type>::const_iterator mit = mappings.begin(); mit != mappings.end(); ++mit)
78 stream << obj->
process(str) << std::endl;
std::string type_key() const
Exception for the case the generator is unable to deal with the operation.
Struct for holding the type family as well as the type of an operation (could be addition, subtraction, norm, etc.)
void process_all_at(std::string const &type_key, std::string const &str, utils::kernel_generation_stream &stream, std::vector< mapping_type > const &mappings, vcl_size_t root_idx, leaf_t leaf)
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
bool elementwise_function(scheduler::op_element const &op)
void process_all(std::string const &type_key, std::string const &str, utils::kernel_generation_stream &stream, std::vector< mapping_type > const &mappings)
std::string evaluate(leaf_t leaf, std::map< std::string, std::string > const &accessors, scheduler::statement const &statement, vcl_size_t root_idx, mapping_type const &mapping)
std::string process(std::string const &in) const
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
void compute_reduction(utils::kernel_generation_stream &os, std::string acc, std::string cur, scheduler::op_element const &op)
Code for parsing the expression trees.
void compute_index_reduction(utils::kernel_generation_stream &os, std::string acc, std::string cur, std::string const &acc_value, std::string const &cur_value, scheduler::op_element const &op)
ValueT const & at(std::map< KeyT, ValueT > const &map, KeyT const &key)
Emulation of C++11's .at() member for std::map<>, const-version.
std::pair< vcl_size_t, leaf_t > mapping_key
std::string neutral_element(scheduler::op_element const &op)