8#include <similie/misc/specialization.hpp>
9#include <similie/tensor/tensor_impl.hpp>
10#include <similie/tensor/tensor_indices/relabelization.hpp>
26template <
class NaturalIndices>
27struct TensorNaturalIndexFromTypeSeqDim;
29template <
class... CDim>
30struct TensorNaturalIndexFromTypeSeqDim<
ddc::TypeSeq<CDim...>>
38template <TensorNatIndex NaturalIndex>
40 : detail::TensorNaturalIndexFromTypeSeqDim<typename NaturalIndex::type_seq_dimensions>::type
45template <TensorNatIndex NaturalIndex>
47 : detail::TensorNaturalIndexFromTypeSeqDim<typename NaturalIndex::type_seq_dimensions>::type
58template <TensorNatIndex NaturalIndex>
64template <TensorNatIndex NaturalIndex>
65struct Lower<Contravariant<NaturalIndex>>
67 using type = Covariant<NaturalIndex>;
70template <
template <
class...>
class T, TensorIndex... Index>
71struct Lower<T<Index...>>
73 using type = T<typename Lower<Index>::type...>;
86template <TensorNatIndex NaturalIndex>
92template <TensorNatIndex NaturalIndex>
98template <
template <
class...>
class T,
TensorIndex... Index>
99struct Upper<T<Index...>>
101 using type = T<typename Upper<Index>::type...>;
111template <
class Index>
114template <TensorNatIndex NaturalIndex>
115struct SwapCharacter<
Covariant<NaturalIndex>>
120template <TensorNatIndex NaturalIndex>
126template <
template <
class...>
class T,
TensorIndex... Index>
127struct SwapCharacter<T<Index...>>
129 using type = T<typename SwapCharacter<Index>::type...>;
139template <
class Index>
140struct Uncharacterize;
142template <
class NaturalIndex>
143struct Uncharacterize<
Covariant<NaturalIndex>>
145 using type = NaturalIndex;
148template <
class NaturalIndex>
151 using type = NaturalIndex;
154template <
template <
class...>
class T,
TensorIndex... Index>
155struct Uncharacterize<T<Index...>>
157 using type = T<typename Uncharacterize<Index>::type...>;
160template <
class Index>
163 using type = detail::RelabelizeIndices<
165 ddc::to_type_seq_t<typename Index::subindices_domain_t>,
166 typename Uncharacterize<
167 ddc::to_type_seq_t<typename Index::subindices_domain_t>>::type>::type;
172template <
class Index>
177template <misc::Specialization<Tensor> TensorType>
180 ddc::to_type_seq_t<typename TensorType::accessor_t::natural_domain_t>,
183template <misc::Specialization<Tensor> TensorType>
185 TensorType
const& tensor)
188 ddc::to_type_seq_t<typename TensorType::accessor_t::natural_domain_t>,
190 ddc::to_type_seq_t<typename TensorType::accessor_t::natural_domain_t>>>(tensor);
196template <TensorNatIndex Index>
199template <TensorNatIndex Index>
200struct IsCovariant<Covariant<Index>>
202 static constexpr bool value =
true;
205template <TensorNatIndex Index>
206struct IsCovariant<Contravariant<Index>>
208 static constexpr bool value =
false;
222struct AreCovariant<
ddc::TypeSeq<Index...>>
229template <misc::Specialization<ddc::TypeSeq> Seq>
235template <TensorNatIndex Index>
236struct IsContravariant;
238template <TensorNatIndex Index>
241 static constexpr bool value =
false;
244template <TensorNatIndex Index>
247 static constexpr bool value =
true;
258struct AreContravariant;
261struct AreContravariant<
ddc::TypeSeq<Index...>>
268template <misc::Specialization<ddc::TypeSeq> Seq>
274template <TensorNatIndex Index1, TensorNatIndex Index2>
275struct IsSameCharacter;
277template <TensorNatIndex Index1, TensorNatIndex Index2>
280 static constexpr bool value =
true;
283template <TensorNatIndex Index1, TensorNatIndex Index2>
286 static constexpr bool value =
false;
289template <TensorNatIndex Index1, TensorNatIndex Index2>
292 static constexpr bool value =
false;
295template <TensorNatIndex Index1, TensorNatIndex Index2>
298 static constexpr bool value =
true;
303template <
class T1,
class T2>
308template <
class T1,
class T2>
309struct AreSameCharacters;
317struct AreSameCharacters<T<HeadIndex1, TailIndex1...>, T<HeadIndex2, TailIndex2...>>
319 static constexpr bool value = IsSameCharacter<HeadIndex1, HeadIndex2>::value
320 && AreSameCharacters<T<TailIndex1...>, T<TailIndex2...>>::value;
325template <
class T1,
class T2>
330template <
class T1,
class T2>
331struct AreDifferentCharacters;
334struct AreDifferentCharacters<T<>, T<>>
336 static constexpr bool value =
true;
345struct AreDifferentCharacters<T<HeadIndex1, TailIndex1...>, T<HeadIndex2, TailIndex2...>>
347 static constexpr bool value
348 = !IsSameCharacter<HeadIndex1, HeadIndex2>::value
349 && AreDifferentCharacters<T<TailIndex1...>, T<TailIndex2...>>::value;
354template <
class T1,
class T2>
constexpr bool are_same_characters_v
detail::RelabelizeIndicesOfType< TensorType, OldIndices, NewIndices >::type relabelize_indices_of_t
detail::Upper< T >::type upper_t
bool constexpr are_covariant_v
bool constexpr is_contravariant_v
constexpr bool is_same_character_v
constexpr bool are_different_characters_v
KOKKOS_FUNCTION constexpr uncharacterize_tensor_t< TensorType > uncharacterize_tensor(TensorType const &tensor)
detail::SwapCharacter< T >::type swap_character_t
KOKKOS_FUNCTION constexpr relabelize_indices_of_t< Tensor, OldIndices, NewIndices > relabelize_indices_of(Tensor const &tensor)
detail::Uncharacterize< Index >::type uncharacterize_t
detail::Lower< T >::type lower_t
bool constexpr is_covariant_v
relabelize_indices_of_t< TensorType, ddc::to_type_seq_t< typename TensorType::accessor_t::natural_domain_t >, uncharacterize_t< ddc::to_type_seq_t< typename TensorType::accessor_t::natural_domain_t > > > uncharacterize_tensor_t
bool constexpr are_contravariant_v
The top-level namespace of SimiLie.