9 #ifndef BC_EXPRESSION_TEMPLATES_FUNCTION_DOT_H_ 10 #define BC_EXPRESSION_TEMPLATES_FUNCTION_DOT_H_ 21 template<
class lv,
class rv,
class SystemTag>
22 struct Bin_Op<oper::dot<SystemTag>, lv, rv>:
27 static_assert(std::is_same<
28 typename lv::value_type,
29 typename rv::value_type>::value,
30 "ValueType must be the same");
33 lv::tensor_dim == 1 &&
34 (rv::tensor_dim == 1 || rv::tensor_dim ==0),
35 "DOT DIMENSION MISMATCH, INTERNAL BUG, REPORT PLEASE");
56 template<
class Core,
int Alpha,
int Beta,
class Stream>
58 static_assert(Core::tensor_dim == 0,
"Output must be a scalar");
62 auto X = greedy_evaluate(left, stream);
63 auto Y = greedy_evaluate(right, stream);
64 auto& out = output.
data();
70 X.data(), X.leading_dim(0),
71 Y.data(), Y.leading_dim(0));
73 constexpr
int beta_value = Beta == 0 ? 1 : Beta;
77 if (lv_scalar || rv_scalar) {
80 blas_tools::scalar_multiply(stream, out.data(), beta_value, alpha_lv, alpha_rv);
81 }
else if (beta_value != 1) {
82 blas_tools::scalar_multiply(stream, out.data(), out.data(), beta_value);
void eval(Output_Data< Core, Alpha, Beta > output, Stream stream) const
Definition: function_dot.h:57
Definition: tree_output_data.h:18
lv left
Definition: function_dot.h:43
Definition: blas_expression_parser.h:23
size_t value_type
Definition: shape.h:120
Definition: blas_expression_template_traits.h:126
Bin_Op(lv left, rv right, oper::dot< system_tag > op=oper::dot< system_tag >())
Definition: function_dot.h:48
static auto get_scalar(const T &expression) -> decltype(detail::remove_scalar_mul< T >::get_scalar(expression))
Definition: blas_expression_template_traits.h:160
rv right
Definition: function_dot.h:44
SystemTag system_tag
Definition: function_dot.h:38
Definition: expression_template_base.h:77
static oper::dot< system_tag > get_operation()
Definition: function_dot.h:52
static constexpr int tensor_iterator_dim
Definition: expression_binary.h:56
static constexpr int tensor_dim
Definition: expression_binary.h:30
const Tensor & data() const
Definition: tree_output_data.h:26
The Evaluator determines if an expression needs to be greedily optimized.
Definition: algorithms.h:22