All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
execute_elementwise.hpp
Go to the documentation of this file.
#ifndef VIENNACL_SCHEDULER_EXECUTE_ELEMENTWISE_HPP
#define VIENNACL_SCHEDULER_EXECUTE_ELEMENTWISE_HPP
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#include "viennacl/forwards.h"
#include "viennacl/scheduler/forwards.h"
#include "viennacl/scheduler/execute_util.hpp"
#include "viennacl/linalg/vector_operations.hpp"
#include "viennacl/linalg/matrix_operations.hpp"
namespace viennacl
{
namespace scheduler
{
namespace detail
{
// result = element_op(x,y) for vectors or matrices x, y
inline void element_op(lhs_rhs_element result,
lhs_rhs_element const & x,
operation_node_type op_type)
{
assert( result.numeric_type == x.numeric_type && bool("Numeric type not the same!"));
assert( result.type_family == x.type_family && bool("Subtype not the same!"));
if (x.subtype == DENSE_VECTOR_TYPE)
{
assert( result.subtype == x.subtype && bool("result not of vector type for unary elementwise operation"));
if (x.numeric_type == FLOAT_TYPE)
{
switch (op_type)
{
#define VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPNAME, NumericT, OPTAG) \
case OPNAME: viennacl::linalg::element_op(*result.vector_##NumericT, \
viennacl::vector_expression<const vector_base<NumericT>, const vector_base<NumericT>, \
op_element_unary<OPTAG> >(*x.vector_##NumericT, *x.vector_##NumericT)); break;
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, float, op_abs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, float, op_acos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, float, op_asin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, float, op_atan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, float, op_ceil)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, float, op_cos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, float, op_cosh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, float, op_exp)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, float, op_fabs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, float, op_floor)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, float, op_log)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, float, op_log10)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, float, op_sin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, float, op_sinh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, float, op_sqrt)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, float, op_tan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, float, op_tanh)
default:
throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
}
}
else if (x.numeric_type == DOUBLE_TYPE)
{
switch (op_type)
{
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, double, op_abs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, double, op_acos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, double, op_asin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, double, op_atan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, double, op_ceil)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, double, op_cos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, double, op_cosh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, double, op_exp)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, double, op_fabs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, double, op_floor)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, double, op_log)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, double, op_log10)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, double, op_sin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, double, op_sinh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, double, op_sqrt)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, double, op_tan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, double, op_tanh)
#undef VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP
default:
throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
}
}
else
throw statement_not_supported_exception("Invalid numeric type in unary elementwise operator");
}
else if (x.subtype == DENSE_MATRIX_TYPE)
{
if (x.numeric_type == FLOAT_TYPE)
{
switch (op_type)
{
#define VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPNAME, NumericT, OPTAG) \
case OPNAME: viennacl::linalg::element_op(*result.matrix_##NumericT, \
viennacl::matrix_expression<const matrix_base<NumericT>, const matrix_base<NumericT>, \
op_element_unary<OPTAG> >(*x.matrix_##NumericT, *x.matrix_##NumericT)); break;
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, float, op_abs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, float, op_acos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, float, op_asin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, float, op_atan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, float, op_ceil)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, float, op_cos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, float, op_cosh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, float, op_exp)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, float, op_fabs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, float, op_floor)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, float, op_log)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, float, op_log10)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, float, op_sin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, float, op_sinh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, float, op_sqrt)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, float, op_tan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, float, op_tanh)
default:
throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
}
}
else if (x.numeric_type == DOUBLE_TYPE)
{
switch (op_type)
{
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, double, op_abs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, double, op_acos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, double, op_asin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, double, op_atan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, double, op_ceil)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, double, op_cos)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, double, op_cosh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, double, op_exp)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, double, op_fabs)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, double, op_floor)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, double, op_log)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, double, op_log10)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, double, op_sin)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, double, op_sinh)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, double, op_sqrt)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, double, op_tan)
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, double, op_tanh)
default:
throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
}
}
else
throw statement_not_supported_exception("Invalid numeric type in unary elementwise operator");
#undef VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP
}
}
// result = element_op(x,y) for vectors or matrices x, y
inline void element_op(lhs_rhs_element result,
lhs_rhs_element const & x,
lhs_rhs_element const & y,
operation_node_type op_type)
{
assert( x.numeric_type == y.numeric_type && bool("Numeric type not the same!"));
assert( result.numeric_type == y.numeric_type && bool("Numeric type not the same!"));
assert( x.type_family == y.type_family && bool("Subtype not the same!"));
assert( result.type_family == y.type_family && bool("Subtype not the same!"));
switch (op_type)
{
case OPERATION_BINARY_ELEMENT_DIV_TYPE:
if (x.subtype == DENSE_VECTOR_TYPE)
{
switch (x.numeric_type)
{
case FLOAT_TYPE:
viennacl::linalg::element_op(*result.vector_float,
vector_expression<const vector_base<float>,
const vector_base<float>,
op_element_binary<op_div> >(*x.vector_float, *y.vector_float));
break;
case DOUBLE_TYPE:
viennacl::linalg::element_op(*result.vector_double,
vector_expression<const vector_base<double>,
const vector_base<double>,
op_element_binary<op_div> >(*x.vector_double, *y.vector_double));
break;
default:
throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
}
}
else if (x.subtype == DENSE_MATRIX_TYPE)
{
switch (x.numeric_type)
{
case FLOAT_TYPE:
viennacl::linalg::element_op(*result.matrix_float,
matrix_expression< const matrix_base<float>,
const matrix_base<float>,
op_element_binary<op_div> >(*x.matrix_float, *y.matrix_float));
break;
case DOUBLE_TYPE:
viennacl::linalg::element_op(*result.matrix_double,
matrix_expression< const matrix_base<double>,
const matrix_base<double>,
op_element_binary<op_div> >(*x.matrix_double, *y.matrix_double));
break;
default:
throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
}
}
else
throw statement_not_supported_exception("Invalid operand type for binary elementwise division");
break;
case OPERATION_BINARY_ELEMENT_PROD_TYPE:
if (x.subtype == DENSE_VECTOR_TYPE)
{
switch (x.numeric_type)
{
case FLOAT_TYPE:
viennacl::linalg::element_op(*result.vector_float,
vector_expression<const vector_base<float>,
const vector_base<float>,
op_element_binary<op_prod> >(*x.vector_float, *y.vector_float));
break;
case DOUBLE_TYPE:
viennacl::linalg::element_op(*result.vector_double,
vector_expression<const vector_base<double>,
const vector_base<double>,
op_element_binary<op_prod> >(*x.vector_double, *y.vector_double));
break;
default:
throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
}
}
else if (x.subtype == DENSE_MATRIX_TYPE)
{
switch (x.numeric_type)
{
case FLOAT_TYPE:
viennacl::linalg::element_op(*result.matrix_float,
matrix_expression< const matrix_base<float>,
const matrix_base<float>,
op_element_binary<op_prod> >(*x.matrix_float, *y.matrix_float));
break;
case DOUBLE_TYPE:
viennacl::linalg::element_op(*result.matrix_double,
matrix_expression< const matrix_base<double>,
const matrix_base<double>,
op_element_binary<op_prod> >(*x.matrix_double, *y.matrix_double));
break;
default:
throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
}
}
else
throw statement_not_supported_exception("Invalid operand type for binary elementwise division");
break;
case OPERATION_BINARY_ELEMENT_POW_TYPE:
if (x.subtype == DENSE_VECTOR_TYPE)
{
switch (x.numeric_type)
{
case FLOAT_TYPE:
viennacl::linalg::element_op(*result.vector_float,
vector_expression<const vector_base<float>,
const vector_base<float>,
op_element_binary<op_pow> >(*x.vector_float, *y.vector_float));
break;
case DOUBLE_TYPE:
viennacl::linalg::element_op(*result.vector_double,
vector_expression<const vector_base<double>,
const vector_base<double>,
op_element_binary<op_pow> >(*x.vector_double, *y.vector_double));
break;
default:
throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
}
}
else if (x.subtype == DENSE_MATRIX_TYPE)
{
switch (x.numeric_type)
{
case FLOAT_TYPE:
viennacl::linalg::element_op(*result.matrix_float,
matrix_expression< const matrix_base<float>,
const matrix_base<float>,
op_element_binary<op_pow> >(*x.matrix_float, *y.matrix_float));
break;
case DOUBLE_TYPE:
viennacl::linalg::element_op(*result.matrix_double,
matrix_expression< const matrix_base<double>,
const matrix_base<double>,
op_element_binary<op_pow> >(*x.matrix_double, *y.matrix_double));
break;
default:
throw statement_not_supported_exception("Invalid numeric type for binary elementwise power");
}
}
else
throw statement_not_supported_exception("Invalid operand type for binary elementwise power");
break;
default:
throw statement_not_supported_exception("Invalid operation type for binary elementwise operations");
}
}
}
inline void execute_element_composite(statement const & s, statement_node const & root_node)
{
statement_node const & leaf = s.array()[root_node.rhs.node_index];
viennacl::context ctx = detail::extract_context(root_node);
statement_node new_root_lhs;
statement_node new_root_rhs;
// check for temporary on lhs:
if (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY)
{
detail::new_element(new_root_lhs.lhs, root_node.lhs, ctx);
new_root_lhs.op.type_family = OPERATION_BINARY_TYPE_FAMILY;
new_root_lhs.op.type = OPERATION_BINARY_ASSIGN_TYPE;
new_root_lhs.rhs.type_family = COMPOSITE_OPERATION_FAMILY;
new_root_lhs.rhs.subtype = INVALID_SUBTYPE;
new_root_lhs.rhs.numeric_type = INVALID_NUMERIC_TYPE;
new_root_lhs.rhs.node_index = leaf.lhs.node_index;
// work on subexpression:
// TODO: Catch exception, free temporary, then rethrow
detail::execute_composite(s, new_root_lhs);
}
if (leaf.op.type == OPERATION_BINARY_ELEMENT_PROD_TYPE || leaf.op.type == OPERATION_BINARY_ELEMENT_DIV_TYPE || leaf.op.type == OPERATION_BINARY_ELEMENT_POW_TYPE)
{
// check for temporary on rhs:
if (leaf.rhs.type_family == COMPOSITE_OPERATION_FAMILY)
{
detail::new_element(new_root_rhs.lhs, root_node.lhs, ctx);
new_root_rhs.op.type_family = OPERATION_BINARY_TYPE_FAMILY;
new_root_rhs.op.type = OPERATION_BINARY_ASSIGN_TYPE;
new_root_rhs.rhs.type_family = COMPOSITE_OPERATION_FAMILY;
new_root_rhs.rhs.subtype = INVALID_SUBTYPE;
new_root_rhs.rhs.numeric_type = INVALID_NUMERIC_TYPE;
new_root_rhs.rhs.node_index = leaf.rhs.node_index;
// work on subexpression:
// TODO: Catch exception, free temporary, then rethrow
detail::execute_composite(s, new_root_rhs);
}
lhs_rhs_element x = (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY) ? new_root_lhs.lhs : leaf.lhs;
lhs_rhs_element y = (leaf.rhs.type_family == COMPOSITE_OPERATION_FAMILY) ? new_root_rhs.lhs : leaf.rhs;
// compute element-wise operation:
detail::element_op(root_node.lhs, x, y, leaf.op.type);
if (leaf.rhs.type_family == COMPOSITE_OPERATION_FAMILY)
detail::delete_element(new_root_rhs.lhs);
}
else if (leaf.op.type_family == OPERATION_UNARY_TYPE_FAMILY)
{
lhs_rhs_element x = (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY) ? new_root_lhs.lhs : leaf.lhs;
// compute element-wise operation:
detail::element_op(root_node.lhs, x, leaf.op.type);
}
else
throw statement_not_supported_exception("Unsupported elementwise operation.");
// clean up:
if (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY)
detail::delete_element(new_root_lhs.lhs);
}
} // namespace scheduler
} // namespace viennacl
#endif
viennacl::scheduler::OPERATION_UNARY_ATAN_TYPE
Definition: forwards.h:91
viennacl::op_cosh
A tag class representing the cosh() function.
Definition: forwards.h:155
viennacl::op_tan
A tag class representing the tan() function.
Definition: forwards.h:181
viennacl::scheduler::OPERATION_BINARY_ELEMENT_POW_TYPE
Definition: forwards.h:134
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP
#define VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPNAME, NumericT, OPTAG)
matrix_operations.hpp
Implementations of dense matrix related operations including matrix-vector products.
viennacl::scheduler::OPERATION_UNARY_COS_TYPE
Definition: forwards.h:93
vector_operations.hpp
Implementations of vector operations.
viennacl::scheduler::OPERATION_UNARY_FABS_TYPE
Definition: forwards.h:96
viennacl::scheduler::detail::extract_context
viennacl::context extract_context(statement_node const &root_node)
Helper routine for extracting the context in which a statement is executed.
Definition: execute_util.hpp:105
viennacl::scheduler::DENSE_VECTOR_TYPE
Definition: forwards.h:271
viennacl::scheduler::OPERATION_BINARY_ELEMENT_DIV_TYPE
Definition: forwards.h:127
viennacl::scheduler::DOUBLE_TYPE
Definition: forwards.h:300
viennacl::scheduler::INVALID_SUBTYPE
Definition: forwards.h:266
viennacl::scheduler::OPERATION_UNARY_ACOS_TYPE
Definition: forwards.h:89
viennacl::scheduler::OPERATION_UNARY_EXP_TYPE
Definition: forwards.h:95
viennacl::matrix_base< float >
viennacl::op_abs
A tag class representing the modulus function for integers.
Definition: forwards.h:137
viennacl::scheduler::lhs_rhs_element::subtype
statement_node_subtype subtype
Definition: forwards.h:340
viennacl::matrix_expression
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:341
viennacl::op_ceil
A tag class representing the ceil() function.
Definition: forwards.h:151
viennacl::scheduler::OPERATION_UNARY_ASIN_TYPE
Definition: forwards.h:90
viennacl::scheduler::statement_node::op
op_element op
Definition: forwards.h:481
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::scheduler::lhs_rhs_element::type_family
statement_node_type_family type_family
Definition: forwards.h:339
viennacl::scheduler::OPERATION_BINARY_ASSIGN_TYPE
Definition: forwards.h:115
viennacl::scheduler::lhs_rhs_element
A class representing the 'data' for the LHS or RHS operand of the respective node.
Definition: forwards.h:337
viennacl::scheduler::statement::array
container_type const & array() const
Definition: forwards.h:528
viennacl::scheduler::execute_element_composite
void execute_element_composite(statement const &s, statement_node const &root_node)
Deals with x = RHS where RHS is a vector expression.
Definition: execute_elementwise.hpp:334
viennacl::vector_expression
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:239
viennacl::linalg::element_op
void element_op(matrix_base< T > &A, matrix_expression< const matrix_base< T >, const matrix_base< T >, OP > const &proxy)
Implementation of the element-wise operation A = B .* C and A = B ./ C for matrices (using MATLAB syn...
Definition: matrix_operations.hpp:702
viennacl::op_log
A tag class representing the log() function.
Definition: forwards.h:171
viennacl::scheduler::op_element::type_family
operation_node_type_family type_family
Definition: forwards.h:473
viennacl::op_tanh
A tag class representing the tanh() function.
Definition: forwards.h:183
viennacl::scheduler::OPERATION_BINARY_ELEMENT_PROD_TYPE
Definition: forwards.h:126
viennacl::op_fabs
A tag class representing the fabs() function.
Definition: forwards.h:159
viennacl::scheduler::lhs_rhs_element::matrix_double
viennacl::matrix_base< double > * matrix_double
Definition: forwards.h:410
viennacl::scheduler::detail::delete_element
void delete_element(lhs_rhs_element &elem)
Definition: execute_util.hpp:266
viennacl::context
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
Definition: context.hpp:39
viennacl::scheduler::COMPOSITE_OPERATION_FAMILY
Definition: forwards.h:251
viennacl::op_atan
A tag class representing the atan() function.
Definition: forwards.h:147
viennacl::op_sinh
A tag class representing the sinh() function.
Definition: forwards.h:177
viennacl::scheduler::DENSE_MATRIX_TYPE
Definition: forwards.h:274
viennacl::scheduler::OPERATION_UNARY_LOG_TYPE
Definition: forwards.h:98
viennacl::scheduler::OPERATION_UNARY_SQRT_TYPE
Definition: forwards.h:102
viennacl::op_exp
A tag class representing the exp() function.
Definition: forwards.h:157
viennacl::scheduler::INVALID_NUMERIC_TYPE
Definition: forwards.h:288
viennacl::scheduler::OPERATION_UNARY_SINH_TYPE
Definition: forwards.h:101
viennacl::scheduler::lhs_rhs_element::numeric_type
statement_node_numeric_type numeric_type
Definition: forwards.h:341
viennacl::scheduler::lhs_rhs_element::vector_float
viennacl::vector_base< float > * vector_float
Definition: forwards.h:385
viennacl::scheduler::OPERATION_UNARY_SIN_TYPE
Definition: forwards.h:100
viennacl::scheduler::statement_node::rhs
lhs_rhs_element rhs
Definition: forwards.h:482
viennacl::scheduler::lhs_rhs_element::matrix_float
viennacl::matrix_base< float > * matrix_float
Definition: forwards.h:409
viennacl::vector_base< float >
viennacl::op_sqrt
A tag class representing the sqrt() function.
Definition: forwards.h:179
viennacl::scheduler::OPERATION_UNARY_ABS_TYPE
Definition: forwards.h:88
viennacl::scheduler::statement_node::lhs
lhs_rhs_element lhs
Definition: forwards.h:480
viennacl::scheduler::lhs_rhs_element::vector_double
viennacl::vector_base< double > * vector_double
Definition: forwards.h:386
viennacl::scheduler::OPERATION_BINARY_TYPE_FAMILY
Definition: forwards.h:59
forwards.h
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
viennacl::scheduler::OPERATION_UNARY_LOG10_TYPE
Definition: forwards.h:99
viennacl::scheduler::detail::execute_composite
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...
Definition: execute.hpp:42
viennacl::scheduler::OPERATION_UNARY_FLOOR_TYPE
Definition: forwards.h:97
viennacl::scheduler::operation_node_type
operation_node_type
Enumeration for identifying the possible operations.
Definition: forwards.h:68
viennacl::op_sin
A tag class representing the sin() function.
Definition: forwards.h:175
viennacl::scheduler::detail::new_element
void new_element(lhs_rhs_element &new_elem, lhs_rhs_element const &old_element, viennacl::context const &ctx)
Definition: execute_util.hpp:204
viennacl::op_floor
A tag class representing the floor() function.
Definition: forwards.h:163
viennacl::scheduler::OPERATION_UNARY_TAN_TYPE
Definition: forwards.h:103
viennacl::op_asin
A tag class representing the asin() function.
Definition: forwards.h:141
viennacl::scheduler::OPERATION_UNARY_CEIL_TYPE
Definition: forwards.h:92
viennacl::scheduler::op_element::type
operation_node_type type
Definition: forwards.h:474
viennacl::scheduler::OPERATION_UNARY_TANH_TYPE
Definition: forwards.h:104
viennacl::scheduler::FLOAT_TYPE
Definition: forwards.h:299
viennacl::op_element_binary
A tag class representing element-wise binary operations (like multiplication) on vectors or matrices...
Definition: forwards.h:130
viennacl::scheduler::statement
The main class for representing a statement such as x = inner_prod(y,z); at runtime.
Definition: forwards.h:502
viennacl::scheduler::lhs_rhs_element::node_index
vcl_size_t node_index
Definition: forwards.h:346
viennacl::op_acos
A tag class representing the acos() function.
Definition: forwards.h:139
viennacl::op_log10
A tag class representing the log10() function.
Definition: forwards.h:173
viennacl::scheduler::OPERATION_UNARY_COSH_TYPE
Definition: forwards.h:94
viennacl::scheduler::detail::element_op
void element_op(lhs_rhs_element result, lhs_rhs_element const &x, operation_node_type op_type)
Definition: execute_elementwise.hpp:39
execute_util.hpp
Provides various utilities for implementing the execution of statements.
viennacl::op_cos
A tag class representing the cos() function.
Definition: forwards.h:153
viennacl::scheduler::statement_node
Main datastructure for an node in the statement tree.
Definition: forwards.h:478
viennacl::scheduler::statement_not_supported_exception
Exception for the case the scheduler is unable to deal with the operation.
Definition: forwards.h:38
viennacl::scheduler::OPERATION_UNARY_TYPE_FAMILY
Definition: forwards.h:58