1 #ifndef VIENNACL_SCHEDULER_STATEMENT_HPP
2 #define VIENNACL_SCHEDULER_STATEMENT_HPP
42 statement_not_supported_exception(std::string message) : message_(
"ViennaCL: Internal error: The scheduler encountered a problem with the operation provided: " + message) {}
44 virtual const char*
what()
const throw() {
return message_.c_str(); }
315 template<>
struct numeric_type_id<unsigned char> {
enum { value =
UCHAR_TYPE }; };
316 template<>
struct numeric_type_id<short> {
enum { value =
SHORT_TYPE }; };
317 template<>
struct numeric_type_id<unsigned short> {
enum { value =
USHORT_TYPE }; };
318 template<>
struct numeric_type_id<int> {
enum { value =
INT_TYPE }; };
319 template<>
struct numeric_type_id<unsigned int> {
enum { value =
UINT_TYPE }; };
320 template<>
struct numeric_type_id<long> {
enum { value =
LONG_TYPE }; };
321 template<>
struct numeric_type_id<unsigned long> {
enum { value =
ULONG_TYPE }; };
322 template<>
struct numeric_type_id<float> {
enum { value =
FLOAT_TYPE }; };
323 template<>
struct numeric_type_id<double> {
enum { value =
DOUBLE_TYPE }; };
514 template<
typename LHS,
typename OP,
typename RHS>
515 statement(LHS & lhs, OP
const &, RHS
const & rhs) : array_(1 + result_of::num_nodes<RHS>::value)
744 template<
typename LHS,
typename RHS,
typename OP>
753 return add_node(next_free, next_free + 1, t);
756 template<
typename LHS,
typename RHS,
typename OP>
764 elem.node_index = next_free;
765 return add_node(next_free, next_free + 1, t);
768 template<
typename LHS,
typename RHS,
typename OP>
776 elem.node_index = next_free;
777 return add_node(next_free, next_free + 1, t);
786 return add_element(next_free, array_[current_index].lhs, t);
792 return add_element(next_free, array_[current_index].rhs, t);
797 template<
template<
typename,
typename,
typename>
class ExpressionT,
typename LHS,
typename RHS,
typename OP>
811 return add_lhs(current_index, next_free, proxy.lhs());
814 return add_rhs(current_index, add_lhs(current_index, next_free, proxy.lhs()), proxy.rhs());
Simple enable-if variant that uses the SFINAE pattern.
static void assign_element(lhs_rhs_element &elem, unsigned short const &t)
viennacl::implicit_vector_base< float > * implicit_vector_float
viennacl::scalar< float > * scalar_float
viennacl::vector_base< unsigned short > * vector_ushort
viennacl::implicit_vector_base< int > * implicit_vector_int
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< char > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< float > const &t)
viennacl::vector_base< unsigned int > * vector_uint
viennacl::implicit_vector_base< unsigned char > * implicit_vector_uchar
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned char > const &t)
viennacl::matrix_base< short > * matrix_short
viennacl::vector_base< short > * vector_short
viennacl::scalar< short > * scalar_short
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< short > const &t)
statement_node value_type
statement(LHS &lhs, OP const &, RHS const &rhs)
Generate the runtime statement from an expression template.
viennacl::matrix_base< char > * matrix_char
viennacl::implicit_matrix_base< unsigned long > * implicit_matrix_ulong
static void assign_element(lhs_rhs_element &elem, char const &t)
static void assign_element(lhs_rhs_element &elem, double const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::hyb_matrix< float > const &m)
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned char > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned long > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< short > const &t)
viennacl::vector_base< int > * vector_int
statement_node_subtype subtype
Expression template class for representing a tree of expressions which ultimately result in a matrix...
static void assign_element(lhs_rhs_element &elem, unsigned char const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< short > const &t)
viennacl::vcl_size_t size_type
T::ERROR_UNKNOWN_OP_TYPE error_type
viennacl::coordinate_matrix< double > * coordinate_matrix_double
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< long > const &t)
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::implicit_vector_base< long > * implicit_vector_long
statement_node_type_family type_family
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned int > const &t)
viennacl::implicit_matrix_base< double > * implicit_matrix_double
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned short > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned short > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< double > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< long > const &t)
A class representing the 'data' for the LHS or RHS operand of the respective node.
viennacl::matrix_base< unsigned char > * matrix_uchar
container_type const & array() const
viennacl::scalar< unsigned int > * scalar_uint
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< char > const &t)
viennacl::scalar< long > * scalar_long
statement_node_numeric_type
Encodes the type of a node in the statement tree.
static void assign_element(lhs_rhs_element &elem, float const &t)
A proxy for scalar expressions (e.g. from inner vector products)
An expression template class that represents a binary operation that yields a vector.
static viennacl::enable_if< viennacl::is_primitive_type< T >::value, vcl_size_t >::type add_element(vcl_size_t next_free, lhs_rhs_element &elem, T const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::ell_matrix< float > const &m)
operation_node_type_family type_family
Struct for holding the type family as well as the type of an operation (could be addition, subtraction, norm, etc.)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< char > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned int > const &t)
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::matrix_base< T > const &t)
viennacl::matrix_base< double > * matrix_double
viennacl::hyb_matrix< double > * hyb_matrix_double
viennacl::implicit_matrix_base< unsigned int > * implicit_matrix_uint
viennacl::scalar< unsigned long > * scalar_ulong
viennacl::implicit_vector_base< unsigned int > * implicit_vector_uint
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< int > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::compressed_matrix< float > const &m)
statement_node_subtype
Encodes the type of a node in the statement tree.
std::vector< value_type > container_type
viennacl::matrix_base< long > * matrix_long
viennacl::matrix_base< unsigned short > * matrix_ushort
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::ell_matrix< T > const &t)
viennacl::implicit_matrix_base< unsigned short > * implicit_matrix_ushort
viennacl::compressed_matrix< float > * compressed_matrix_float
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< int > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< float > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< double > const &t)
virtual ~statement_not_supported_exception()
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned long > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned short > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::coordinate_matrix< float > const &m)
viennacl::implicit_matrix_base< unsigned char > * implicit_matrix_uchar
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::implicit_vector_base< T > const &t)
statement_node_numeric_type numeric_type
viennacl::vector_base< unsigned long > * vector_ulong
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< float > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< double > const &t)
viennacl::vector_base< float > * vector_float
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::hyb_matrix< T > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned int > const &t)
Metafunction for querying type informations.
viennacl::matrix_base< float > * matrix_float
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< float > const &t)
viennacl::implicit_vector_base< char > * implicit_vector_char
viennacl::implicit_vector_base< unsigned long > * implicit_vector_ulong
static void assign_element(lhs_rhs_element &elem, viennacl::ell_matrix< double > const &m)
viennacl::vector_base< double > * vector_double
viennacl::compressed_matrix< double > * compressed_matrix_double
viennacl::ell_matrix< double > * ell_matrix_double
viennacl::matrix_base< unsigned long > * matrix_ulong
viennacl::hyb_matrix< float > * hyb_matrix_float
viennacl::scalar< double > * scalar_double
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned int > const &t)
viennacl::scalar< unsigned short > * scalar_ushort
void execute_composite(statement const &s, statement_node const &root_node)
Deals with x = RHS where RHS is an expression and x is either a scalar, a vector, or a matrix...
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned char > const &t)
operation_node_type
Enumeration for identifying the possible operations.
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< double > const &t)
viennacl::vector_base< char > * vector_char
viennacl::implicit_vector_base< short > * implicit_vector_short
statement(container_type const &custom_array)
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned long > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< long > const &t)
Helper metafunction for obtaining the runtime type ID for a numerical type.
viennacl::scalar< unsigned char > * scalar_uchar
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< short > const &t)
static void assign_element(lhs_rhs_element &elem, int const &t)
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::vector_base< T > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::coordinate_matrix< double > const &m)
static void assign_element(lhs_rhs_element &elem, long const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< int > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned short > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned short > const &t)
viennacl::vector_base< unsigned char > * vector_uchar
scheduler::lhs_rhs_element & lhs_rhs_element(scheduler::statement const &st, vcl_size_t idx, leaf_t leaf)
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned long > const &t)
viennacl::implicit_matrix_base< float > * implicit_matrix_float
viennacl::ell_matrix< float > * ell_matrix_float
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::compressed_matrix< T > const &t)
static void assign_element(lhs_rhs_element &elem, unsigned long const &t)
viennacl::scalar< int > * scalar_int
unsigned short host_ushort
viennacl::implicit_vector_base< double > * implicit_vector_double
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned long > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::compressed_matrix< double > const &m)
statement_not_supported_exception(std::string message)
static void assign_element(lhs_rhs_element &elem, unsigned int const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned char > const &t)
viennacl::implicit_vector_base< unsigned short > * implicit_vector_ushort
The main class for representing a statement such as x = inner_prod(y,z); at runtime.
viennacl::scalar< char > * scalar_char
viennacl::implicit_matrix_base< short > * implicit_matrix_short
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::implicit_matrix_base< T > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned int > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< int > const &t)
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::scalar< T > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< long > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< float > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< char > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< double > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< int > const &t)
viennacl::matrix_base< int > * matrix_int
viennacl::implicit_matrix_base< long > * implicit_matrix_long
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::coordinate_matrix< T > const &t)
viennacl::vector_base< long > * vector_long
viennacl::coordinate_matrix< float > * coordinate_matrix_float
virtual const char * what() const
static void assign_element(lhs_rhs_element &elem, viennacl::hyb_matrix< double > const &m)
statement_not_supported_exception()
viennacl::implicit_matrix_base< char > * implicit_matrix_char
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< char > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< short > const &t)
Main datastructure for an node in the statement tree.
Exception for the case the scheduler is unable to deal with the operation.
Simple enable-if variant that uses the SFINAE pattern.
static void assign_element(lhs_rhs_element &elem, short const &t)
statement_node_type_family
Groups the type of a node in the statement tree. Used for faster dispatching.
viennacl::matrix_base< unsigned int > * matrix_uint
operation_node_type_family
Optimization enum for grouping operations into unary or binary operations. Just for optimization of l...
viennacl::implicit_matrix_base< int > * implicit_matrix_int
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< long > const &t)
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned char > const &t)
A tag class representing element-wise casting operations on vectors and matrices. ...