26 #ifndef TILEDARRAY_TILE_INTERFACE_PERMUTE_H__INCLUDED
27 #define TILEDARRAY_TILE_INTERFACE_PERMUTE_H__INCLUDED
29 #include "../tensor/type_traits.h"
30 #include "../tile_interface/cast.h"
31 #include "../type_traits.h"
43 typename Arg,
typename Perm,
44 typename = std::enable_if_t<detail::is_permutation_v<Perm> &&
45 detail::has_member_function_permute_anyreturn_v<
46 const Arg,
const Perm&>>>
47 inline auto permute(
const Arg& arg,
const Perm& perm) {
48 return arg.permute(perm);
54 namespace tile_interface {
60 permute(std::declval<T>(), std::declval<Permutation>()))>::type;
62 template <
typename Tile,
typename Enabler =
void>
67 template <
typename Arg>
68 struct permute_trait<Arg, typename std::enable_if<TiledArray::detail::is_type<
69 result_of_permute_t<Arg>>::value>
::type> {
73 template <
typename Result,
typename Arg,
typename Enabler =
void>
79 template <
typename Perm,
80 typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
83 if constexpr (detail::is_bipartite_permutable_v<argument_type>) {
92 template <
typename Result,
typename Arg>
94 typename std::enable_if<
95 !std::is_same<Result, result_of_permute_t<Arg>>::value>::type>
104 template <
typename Perm,
105 typename = std::enable_if_t<detail::is_permutation_v<Perm>>>
108 if constexpr (detail::is_bipartite_permutable_v<argument_type>) {
109 return Cast_::operator()(
permute(arg, perm));
125 template <
typename Arg>
133 template <
typename Result,
typename Arg>
138 #endif // TILEDARRAY_TILE_INTERFACE_PERMUTE_H__INCLUDED