26 #ifndef TILEDARRAY_TILE_OP_MULT_H__INCLUDED 27 #define TILEDARRAY_TILE_OP_MULT_H__INCLUDED 49 template <
typename Result,
typename Left,
typename Right,
50 bool LeftConsumable,
bool RightConsumable>
61 LeftConsumable && std::is_same<result_type, left_type>::value;
64 RightConsumable && std::is_same<result_type, right_type>::value;
76 return mult(first, second, perm);
97 template <
bool LC,
bool RC,
98 typename std::enable_if<!(LC || RC)>::type* =
nullptr>
102 return mult(first, second);
105 template <
bool LC,
bool RC,
106 typename std::enable_if<LC>::type* =
nullptr>
112 template <
bool LC,
bool RC,
113 typename std::enable_if<!LC && RC>::type* =
nullptr>
119 template <
bool LC,
bool RC,
120 typename std::enable_if<!RC>::type* =
nullptr>
126 template <
bool LC,
bool RC,
127 typename std::enable_if<RC>::type* =
nullptr>
133 template <
bool LC,
bool RC,
134 typename std::enable_if<!LC>::type* =
nullptr>
140 template <
bool LC,
bool RC,
141 typename std::enable_if<LC>::type* =
nullptr>
158 template <
typename L,
typename R>
161 return eval(std::forward<L>(left), std::forward<R>(right), perm);
172 template <
typename L,
typename R>
174 return Mult_::template eval<left_is_consumable, right_is_consumable>(
175 std::forward<L>(left), std::forward<R>(right));
185 template <
typename R>
187 constexpr
bool can_consume_left =
189 std::is_same<result_type, left_type>::value;
191 ! (std::is_const<R>::value || can_consume_left);
192 return Mult_::template eval<can_consume_left, can_consume_right>(left,
193 std::forward<R>(right));
203 template <
typename L>
205 constexpr
bool can_consume_right =
207 std::is_same<result_type, right_type>::value;
209 ! (std::is_const<L>::value || can_consume_right);
210 return Mult_::template eval<can_consume_left, can_consume_right>(
211 std::forward<L>(left), right);
231 template <
typename Result,
typename Left,
typename Right,
typename Scalar,
232 bool LeftConsumable,
bool RightConsumable>
236 typedef ScalMult<Result, Left, Right, Scalar, LeftConsumable,
245 LeftConsumable && std::is_same<result_type, left_type>::value;
248 RightConsumable && std::is_same<result_type, right_type>::value;
262 return mult(first, second, factor_, perm);
283 template <
bool LC,
bool RC,
284 typename std::enable_if<!(LC || RC)>::type* =
nullptr>
287 return mult(first, second, factor_);
290 template <
bool LC,
bool RC,
291 typename std::enable_if<LC>::type* =
nullptr>
294 return mult_to(first, second, factor_);
297 template <
bool LC,
bool RC,
298 typename std::enable_if<!LC && RC>::type* =
nullptr>
301 return mult_to(second, first, factor_);
304 template <
bool LC,
bool RC,
305 typename std::enable_if<!RC>::type* =
nullptr>
311 template <
bool LC,
bool RC,
312 typename std::enable_if<RC>::type* =
nullptr>
318 template <
bool LC,
bool RC,
319 typename std::enable_if<!LC>::type* =
nullptr>
325 template <
bool LC,
bool RC,
326 typename std::enable_if<LC>::type* =
nullptr>
344 explicit ScalMult(
const Scalar factor) : factor_(factor) { }
355 template <
typename L,
typename R>
358 return eval(std::forward<L>(left), std::forward<R>(right), perm);
369 template <
typename L,
typename R>
382 template <
typename R>
384 constexpr
bool can_consume_left =
386 std::is_same<result_type, left_type>::value;
388 ! (std::is_const<R>::value || can_consume_left);
389 return ScalMult_::template eval<can_consume_left, can_consume_right>(
390 left, std::forward<R>(right));
401 template <
typename L>
403 constexpr
bool can_consume_right =
405 std::is_same<result_type, right_type>::value;
407 ! (std::is_const<L>::value || can_consume_right);
408 return ScalMult_::template eval<can_consume_left, can_consume_right>(
409 std::forward<L>(left), right);
417 #endif // TILEDARRAY_TILE_OP_MULT_H__INCLUDED ScalMult(const ScalMult_ &)=default
static constexpr bool right_is_consumable
Indicates whether it is possible to consume the right tile.
Left left_type
Left-hand argument base type.
Result result_type
Result tile type.
result_type operator()(L &&left, R &&right, const Permutation &perm) const
Scale-multiply-and-permute operator.
static constexpr bool left_is_consumable
Indicates whether it is possible to consume the left tile.
result_type operator()(L &&left, R &&right) const
Multiply operator.
Tile< Result > & mult_to(Tile< Result > &result, const Tile< Arg > &arg)
Multiply to the result tile.
Scalar scalar_type
Scaling factor type.
static constexpr bool left_is_consumable
Indicates whether it is possible to consume the left tile.
Place-holder object for a zero tensor.
result_type consume_left(left_type &left, R &&right) const
Multiply right to left and scale the result.
Mult< Result, Left, Right, LeftConsumable, RightConsumable > Mult_
Right right_type
Right-hand argument base type.
result_type operator()(L &&left, R &&right) const
Scale-and-multiply operator.
Tile scale-multiplication operation.
result_type operator()(L &&left, R &&right, const Permutation &perm) const
Multiply-and-permute operator.
Result result_type
The result tile type.
result_type consume_right(L &&left, right_type &right) const
Multiply left to right and scale the result.
Consumable tile type trait.
Right right_type
Right-hand argument base type.
Tile multiplication operation.
static constexpr bool right_is_consumable
Indicates whether it is possible to consume the right tile.
result_type consume_left(left_type &left, R &&right) const
Multiply right to left.
Left left_type
Left-hand argument base type.
Permutation of a sequence of objects indexed by base-0 indices.
ScalMult< Result, Left, Right, Scalar, LeftConsumable, RightConsumable > ScalMult_
This class type.
result_type consume_right(L &&left, right_type &right) const
Multiply left to right.
decltype(auto) mult(const Tile< Left > &left, const Tile< Right > &right)
Multiplication tile arguments.
ScalMult_ & operator=(const ScalMult_ &)=default
ScalMult(const Scalar factor)
Constructor.