26 #ifndef TILEDARRAY_TILE_OP_SHIFT_H__INCLUDED 27 #define TILEDARRAY_TILE_OP_SHIFT_H__INCLUDED 29 #include "../tile_interface/shift.h" 30 #include "../tile_interface/permute.h" 45 template <
typename Result,
typename Arg,
bool Consumable>
54 Consumable && std::is_same<result_type, argument_type>::value;
58 std::vector<long> range_shift_;
77 template <
bool C,
typename =
void>
80 return shift(arg, range_shift_);
83 template <bool C, typename = typename std::enable_if<C>::type>
90 template <bool C, typename = typename std::enable_if<C>::type>
111 Shift(
const std::vector<long>& range_shift) :
112 range_shift_(range_shift)
122 return eval(arg, perm);
130 template <
typename A>
132 return Shift_::template eval<is_consumable>(std::forward<A>(arg));
140 template <
typename A>
143 std::is_same<result_type, argument_type>::value;
144 return Shift_::template eval<can_consume>(arg);
158 template <
typename Result,
typename Arg,
typename Scalar,
bool Consumable>
168 Consumable && std::is_same<result_type, argument_type>::value;
172 std::vector<long> range_shift_;
186 return shift_to(result, range_shift_);
194 typename std::enable_if<!C, result_type>::type
199 return shift_to(result, range_shift_);
203 typename std::enable_if<C, result_type>::type
227 range_shift_(range_shift), factor_(factor)
238 return eval(arg, perm);
246 template <
typename A>
248 return ScalShift_::template eval<is_consumable>(std::forward<A>(arg));
257 std::is_same<result_type, argument_type>::value;
258 return ScalShift_::template eval<can_consume>(arg);
266 #endif // TILEDARRAY_TILE_OP_SHIFT_H__INCLUDED Shift the range of tile in place.
Arg argument_type
The argument type.
Result result_type
The result tile type.
detail::ShiftWrapper< T > shift(T &tensor)
Shift a tensor from one range to another.
result_type consume(A &arg) const
Explicit consuming shift operation.
void permute(InputOp &&input_op, OutputOp &&output_op, Result &result, const Permutation &perm, const Arg0 &arg0, const Args &... args)
Construct a permuted tensor copy.
Tile< Result > & scale_to(Tile< Result > &result, const Scalar factor)
Scale to the result tile.
void scale(DistArray< Tile, Policy > &a, typename DistArray< Tile, Policy >::element_type scaling_factor)
result_type operator()(A &&arg) const
Consuming shift operation.
ScalShift< Result, Arg, Scalar, Consumable > ScalShift_
This object type.
Shift & operator=(const Shift_ &)=default
std::enable_if< C, result_type >::type eval(argument_type &arg) const
result_type eval(const argument_type &arg, const Permutation &perm) const
result_type operator()(A &&arg) const
Consuming shift operation.
static constexpr bool is_consumable
Indicates whether it is possible to consume the left tile.
static constexpr bool is_consumable
Shift< Result, Arg, Consumable > Shift_
This object type.
ScalShift(const std::vector< long > &range_shift, const scalar_type factor)
Default constructor.
Result result_type
The result tile type.
std::enable_if<!C, result_type >::type eval(const argument_type &arg) const
Scalar scalar_type
The scaling factor type.
Consumable tile type trait.
Arg argument_type
The argument type.
Permutation of a sequence of objects indexed by base-0 indices.
Tile< Arg > & shift_to(Tile< Arg > &arg, const Index &range_shift)
Shift the range of arg in place.
Shift(const std::vector< long > &range_shift)
Default constructor.
ScalShift_ & operator=(const ScalShift_ &)=default
result_type operator()(const argument_type &arg, const Permutation &perm) const
Shift and permute operator.
result_type operator()(const argument_type &arg, const Permutation &perm) const
Shift and permute operator.
result_type consume(argument_type &arg) const
Explicit consuming shift operation.