8 #ifndef BLACKCATTENSORS_TENSORS_EXPRS_BLAS_EXPRESSION_TRAITS_H_ 9 #define BLACKCATTENSORS_TENSORS_EXPRS_BLAS_EXPRESSION_TRAITS_H_ 29 static T
rm(T expression) {
38 template<
class lv,
class rv>
40 using type = std::conditional_t<lv::tensor_dim == 0, rv, lv>;
41 using scalar_type = std::conditional_t<lv::tensor_dim == 0, lv ,rv>;
44 return bc::traits::constexpr_ternary<lv::tensor_dim==0>(
45 [&]() {
return expression.
right; },
46 [&]() {
return expression.
left; }
52 return bc::traits::constexpr_ternary<lv::tensor_dim==0>(
53 [&]() {
return expression.
left; },
54 [&]() {
return expression.
right; }
63 static T
rm(T expression) {
67 template<
class Array,
class SystemTag>
73 return expression.array;
77 template<
class Array,
class SystemTag,
class Rv>
81 Un_Op<oper::transpose<SystemTag>,
93 return expression.left.array;
97 template<
class Array,
class SystemTag,
class Lv>
102 Un_Op<oper::transpose<SystemTag>,
112 Array>> expression) {
113 return expression.right.array;
120 namespace blas_expression_parser {
121 template<
class SystemTag>
122 struct Blas_Expression_Parser;
139 !std::is_same<remove_scalar_mul_type, T>::value>;
142 !std::is_same<remove_transpose_type, T>::value>;
154 remove_scalar_mul(expression));
165 template<
int Alpha,
int Beta,
class Stream>
169 template parse_expression<Alpha, Beta>(
170 stream, expression.left, expression.right);
173 template<
class Stream,
class Contents>
177 template post_parse_expression_evaluation(stream, contents);
static remove_transpose_type remove_transpose(T expression)
Definition: blas_expression_template_traits.h:144
Definition: blas_expression_template_traits.h:24
static type rm(Bin_Op< oper::Scalar_Mul, Un_Op< oper::transpose< SystemTag >, Array >, Rv > expression)
Definition: blas_expression_template_traits.h:87
static T rm(T expression)
Definition: blas_expression_template_traits.h:29
typename T::requires_greedy_evaluation query_requires_greedy_evaluation
Definition: expression_template_traits.h:34
static auto parse_expression(Stream stream, T expression)
Definition: blas_expression_template_traits.h:166
static remove_scalar_mul_type remove_scalar_mul(T expression)
Definition: blas_expression_template_traits.h:148
typename detail::remove_transpose< remove_scalar_mul_type >::type remove_blas_features_type
Definition: blas_expression_template_traits.h:134
Rv right
Definition: expression_binary.h:62
std::conditional_t< lv::tensor_dim==0, lv,rv > scalar_type
Definition: blas_expression_template_traits.h:41
Definition: blas_expression_parser.h:23
Definition: blas_expression_template_traits.h:126
Definition: blas_expression_template_traits.h:61
Lv left
Definition: expression_binary.h:61
static type rm(Bin_Op< oper::Scalar_Mul, lv, rv > expression)
Definition: blas_expression_template_traits.h:43
bc::traits::conditional_detected_t< query_value_type, T, T > * scalar_type
Definition: blas_expression_template_traits.h:27
typename detail::remove_transpose< T >::type remove_transpose_type
Definition: blas_expression_template_traits.h:133
static type rm(Un_Op< oper::transpose< SystemTag >, Array > expression)
Definition: blas_expression_template_traits.h:71
static auto get_scalar(const T &expression) -> decltype(detail::remove_scalar_mul< T >::get_scalar(expression))
Definition: blas_expression_template_traits.h:160
T type
Definition: blas_expression_template_traits.h:62
bc::traits::truth_type< !std::is_same< remove_transpose_type, T >::value > is_transposed
Definition: blas_expression_template_traits.h:142
Definition: expression_template_traits.h:76
static type rm(Bin_Op< oper::Scalar_Mul, Lv, Un_Op< oper::transpose< SystemTag >, Array >> expression)
Definition: blas_expression_template_traits.h:107
T type
Definition: blas_expression_template_traits.h:25
static remove_blas_features_type remove_blas_modifiers(T expression)
Definition: blas_expression_template_traits.h:152
static scalar_type get_scalar(Bin_Op< oper::Scalar_Mul, lv, rv > expression)
Definition: blas_expression_template_traits.h:50
static void post_parse_expression_evaluation(Stream stream, Contents contents)
Definition: blas_expression_template_traits.h:174
std::conditional_t< lv::tensor_dim==0, rv, lv > type
Definition: blas_expression_template_traits.h:40
typename conditional_detected< func, TestType, DefaultType >::type conditional_detected_t
Definition: type_traits.h:87
typename detail::remove_scalar_mul< T >::scalar_type scalar_multiplier_type
Definition: blas_expression_template_traits.h:135
typename detail::remove_scalar_mul< T >::type remove_scalar_mul_type
Definition: blas_expression_template_traits.h:132
typename T::value_type query_value_type
Definition: expression_template_traits.h:28
typename T::value_type value_type
Definition: blas_expression_template_traits.h:136
static scalar_type get_scalar(const T &expression)
Definition: blas_expression_template_traits.h:33
conditional_t< Bool, true_type, false_type > truth_type
Definition: type_traits.h:49
const auto transpose() const
Definition: expression_operations.h:85
static T rm(T expression)
Definition: blas_expression_template_traits.h:63
bc::traits::conditional_detected_t< detail::query_requires_greedy_evaluation, T, std::false_type > requires_greedy_evaluation
Definition: blas_expression_template_traits.h:130
bc::traits::truth_type< !std::is_same< remove_scalar_mul_type, T >::value > is_scalar_multiplied
Definition: blas_expression_template_traits.h:139
Definition: expression_template_traits.h:19
bc::traits::conditional_detected_t< detail::query_system_tag, T, host_tag > system_tag
Definition: expression_template_traits.h:79
The Evaluator determines if an expression needs to be greedily optimized.
Definition: algorithms.h:22