8#include <similie/misc/specialization.hpp>
10#include "relabelization.hpp"
11#include "tensor_impl.hpp"
27template <
class NaturalIndices>
28struct TensorNaturalIndexFromTypeSeqDim;
30template <
class... CDim>
31struct TensorNaturalIndexFromTypeSeqDim<ddc::detail::TypeSeq<CDim...>>
39template <TensorNatIndex NaturalIndex>
41 : detail::TensorNaturalIndexFromTypeSeqDim<typename NaturalIndex::type_seq_dimensions>::type
46template <TensorNatIndex NaturalIndex>
48 : detail::TensorNaturalIndexFromTypeSeqDim<typename NaturalIndex::type_seq_dimensions>::type
59template <TensorNatIndex NaturalIndex>
65template <TensorNatIndex NaturalIndex>
66struct Lower<Contravariant<NaturalIndex>>
68 using type = Covariant<NaturalIndex>;
71template <
template <
class...>
class T, TensorIndex... Index>
72struct Lower<T<Index...>>
74 using type = T<typename Lower<Index>::type...>;
87template <TensorNatIndex NaturalIndex>
93template <TensorNatIndex NaturalIndex>
99template <
template <
class...>
class T,
TensorIndex... Index>
100struct Upper<T<Index...>>
102 using type = T<typename Upper<Index>::type...>;
112template <
class Index>
115template <TensorNatIndex NaturalIndex>
116struct SwapCharacter<
Covariant<NaturalIndex>>
121template <TensorNatIndex NaturalIndex>
127template <
template <
class...>
class T,
TensorIndex... Index>
128struct SwapCharacter<T<Index...>>
130 using type = T<typename SwapCharacter<Index>::type...>;
140template <
class Index>
141struct Uncharacterize;
143template <
class NaturalIndex>
144struct Uncharacterize<
Covariant<NaturalIndex>>
146 using type = NaturalIndex;
149template <
class NaturalIndex>
152 using type = NaturalIndex;
155template <
template <
class...>
class T,
TensorIndex... Index>
156struct Uncharacterize<T<Index...>>
158 using type = T<typename Uncharacterize<Index>::type...>;
161template <
class Index>
164 using type = detail::RelabelizeIndices<
166 ddc::to_type_seq_t<typename Index::subindices_domain_t>,
167 typename Uncharacterize<
168 ddc::to_type_seq_t<typename Index::subindices_domain_t>>::type>::type;
173template <
class Index>
178template <misc::Specialization<Tensor> TensorType>
181 ddc::to_type_seq_t<typename TensorType::accessor_t::natural_domain_t>,
184template <misc::Specialization<Tensor> TensorType>
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::detail::TypeSeq<Index...>>
229template <misc::Specialization<ddc::detail::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::detail::TypeSeq<Index...>>
268template <misc::Specialization<ddc::detail::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;
318struct AreSameCharacters<T<HeadIndex1, TailIndex1...>, T<HeadIndex2, TailIndex2...>>
320 static constexpr bool value = IsSameCharacter<HeadIndex1, HeadIndex2>::value
321 && AreSameCharacters<T<TailIndex1...>, T<TailIndex2...>>::value;
326template <
class T1,
class T2>
331template <
class T1,
class T2>
332struct AreDifferentCharacters;
335struct AreDifferentCharacters<T<>, T<>>
337 static constexpr bool value =
true;
347struct AreDifferentCharacters<T<HeadIndex1, TailIndex1...>, T<HeadIndex2, TailIndex2...>>
349 static constexpr bool value
350 = !IsSameCharacter<HeadIndex1, HeadIndex2>::value
351 && AreDifferentCharacters<T<TailIndex1...>, T<TailIndex2...>>::value;
356template <
class T1,
class T2>
constexpr uncharacterize_tensor_t< TensorType > uncharacterize_tensor(TensorType tensor)
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
detail::SwapCharacter< T >::type swap_character_t
detail::Uncharacterize< Index >::type uncharacterize_t
detail::Lower< T >::type lower_t
constexpr relabelize_indices_of_t< Tensor, OldIndices, NewIndices > relabelize_indices_of(Tensor tensor)
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.