Go to the documentation of this file.
26 #ifndef TILEDARRAY_TILE_OP_SCAL_H__INCLUDED
27 #define TILEDARRAY_TILE_OP_SCAL_H__INCLUDED
30 #include <type_traits>
31 #include "../tile_interface/scale.h"
45 template <
typename Result,
typename Arg,
typename Scalar,
bool Consumable>
54 Consumable && std::is_same<result_type, argument_type>::value;
62 template <
typename Perm,
63 typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
64 result_type eval(
const Arg& arg,
const Perm& perm)
const {
66 return scale(arg, factor_, perm);
73 template <bool C, typename std::enable_if<!C>::type* =
nullptr>
76 return scale(arg, factor_);
79 template <bool C, typename std::enable_if<C>::type* =
nullptr>
104 template <
typename Perm,
105 typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
107 return eval(arg, perm);
115 template <
typename A>
117 return Scal_::template eval<is_consumable>(std::forward<A>(arg));
125 constexpr
bool can_consume =
127 std::is_same<result_type, argument_type>::value;
128 return Scal_::template eval<can_consume>(arg);
136 #endif // TILEDARRAY_TILE_OP_SCAL_H__INCLUDED
result_type operator()(A &&arg) const
Consuming scale operation.
Tile< Result > & scale_to(Tile< Result > &result, const Scalar factor)
Scale to the result tile.
Consumable tile type trait.
Scal< Result, Arg, Scalar, Consumable > Scal_
This object type.
static constexpr bool is_consumable
Scal_ & operator=(Scal_ &&)=default
Scal_ & operator=(const Scal_ &)=default
Scal(const Scal_ &)=default
Scalar scalar_type
The scaling factor type.
result_type consume(argument_type &arg) const
Explicit consuming scale operation.
result_type operator()(const argument_type &arg, const Perm &perm) const
Scale and permute operator.
Scal(const scalar_type factor)
Constructor.
decltype(auto) scale(const Tile< Arg > &arg, const Scalar factor)
Scalar the tile argument.
Result result_type
The result tile type.
Arg argument_type
The argument type.