8#include <similie/csr/csr.hpp>
9#include <similie/misc/stride.hpp>
10#include <similie/tensor/tensor_impl.hpp>
11#include <similie/young_tableau/young_tableau.hpp>
18template <
class YoungTableau, TensorNatIndex... TensorIndex>
31 ddc::DiscreteElement<
TensorIndex...>(ddc::DiscreteElement<TensorIndex>(0)...),
33 ddc::DiscreteVector<TensorIndex>(TensorIndex::size())...));
36 static constexpr std::size_t
rank()
38 return (TensorIndex::rank() + ...);
41 static constexpr std::size_t
size()
43 return (TensorIndex::size() * ...);
48 return YoungTableau::irrep_dim();
56 static constexpr std::pair<std::vector<double>, std::vector<std::size_t>>
mem_lin_comb(
57 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
62 KOKKOS_FUNCTION
static constexpr std::size_t
access_id(
63 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
65 return ((misc::detail::stride<TensorIndex, TensorIndex...>()
66 * natural_ids[ddc::type_seq_rank_v<
TensorIndex, ddc::TypeSeq<TensorIndex...>>])
70 static constexpr std::pair<std::vector<double>, std::vector<std::size_t>>
73 std::pair<std::vector<double>, std::vector<std::size_t>> result {};
74 constexpr csr::Csr v = young_tableau::template v<
77 ddc::DiscreteElement<
TensorIndex...>(ddc::DiscreteElement<TensorIndex>(0)...),
79 ddc::DiscreteVector<TensorIndex>(TensorIndex::size())...)));
80 for (std::size_t j = 0; j < v.
values().
size(); ++j) {
81 if (((v.
idx()[ddc::type_seq_rank_v<
TensorIndex, ddc::TypeSeq<TensorIndex...>>][j]
82 == ((
access_id % misc::detail::next_stride<TensorIndex, TensorIndex...>())
83 / misc::detail::stride<TensorIndex, TensorIndex...>()))
85 std::get<0>(result).push_back(v.
values()[j]);
90 std::get<1>(result).push_back(k);
96 template <
class Tensor,
class Elem,
class Id,
class FunctorType>
98 const FunctorType& access,
102 return access(tensor, elem);
106static_assert(YoungTableauTensorIndexConcept<TensorYoungTableauIndex<
107 sil::young_tableau::YoungTableau<
109 sil::young_tableau::YoungTableauSeq<std::index_sequence<1>>>,
110 TensorNaturalIndex<detail::DimensionConcept>>>);
113template <
class YoungTableauIndex,
class... Id>
116 ddc::DiscreteDomain<YoungTableauIndex>,
117 Kokkos::layout_right,
118 Kokkos::DefaultHostExecutionSpace::memory_space>
122 ddc::DiscreteDomain<YoungTableauIndex>,
123 Kokkos::layout_right,
124 Kokkos::DefaultHostExecutionSpace::memory_space>
const& compressed,
127 ddc::DiscreteDomain<Id...>,
128 Kokkos::layout_right,
129 Kokkos::DefaultHostExecutionSpace::memory_space>
const& tensor)
131 typename YoungTableauIndex::young_tableau young_tableau;
132 csr::Csr u = young_tableau.template u<YoungTableauIndex, Id...>(tensor.domain());
137template <
class YoungTableauIndex,
class... Id>
140 ddc::DiscreteDomain<Id...>,
141 Kokkos::layout_right,
142 Kokkos::DefaultHostExecutionSpace::memory_space>
146 ddc::DiscreteDomain<Id...>,
147 Kokkos::layout_right,
148 Kokkos::DefaultHostExecutionSpace::memory_space>
const& uncompressed,
151 ddc::DiscreteDomain<YoungTableauIndex>,
152 Kokkos::layout_right,
153 Kokkos::DefaultHostExecutionSpace::memory_space>
const& tensor)
155 typename YoungTableauIndex::young_tableau young_tableau;
156 csr::Csr v = young_tableau.template v<YoungTableauIndex, Id...>(uncompressed.domain());
KOKKOS_FUNCTION constexpr std::array< std::size_t, HeadTensorIndex::mem_size()+1 > const & coalesc_idx() const
KOKKOS_FUNCTION constexpr std::array< std::array< std::size_t, N >, sizeof...(TailTensorIndex)> const & idx() const
KOKKOS_FUNCTION constexpr std::array< double, N > const & values() const
sil::tensor::Tensor< double, ddc::DiscreteDomain< TailTensorIndex... >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > tensor_prod(sil::tensor::Tensor< double, ddc::DiscreteDomain< TailTensorIndex... >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > const &prod, sil::tensor::Tensor< double, ddc::DiscreteDomain< HeadTensorIndex >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > const &dense, Csr< N, HeadTensorIndex, TailTensorIndex... > const &csr)
tensor::Tensor< double, ddc::DiscreteDomain< YoungTableauIndex >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > compress(tensor::Tensor< double, ddc::DiscreteDomain< YoungTableauIndex >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > const &compressed, tensor::Tensor< double, ddc::DiscreteDomain< Id... >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > const &tensor)
tensor::Tensor< double, ddc::DiscreteDomain< Id... >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > uncompress(tensor::Tensor< double, ddc::DiscreteDomain< Id... >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > const &uncompressed, tensor::Tensor< double, ddc::DiscreteDomain< YoungTableauIndex >, Kokkos::layout_right, Kokkos::DefaultHostExecutionSpace::memory_space > const &tensor)
The top-level namespace of SimiLie.
static KOKKOS_FUNCTION constexpr subindices_domain_t subindices_domain()
static constexpr std::size_t mem_size()
static constexpr std::size_t size()
static constexpr std::size_t rank()
static KOKKOS_FUNCTION constexpr std::size_t access_id(std::array< std::size_t, sizeof...(TensorIndex)> const &natural_ids)
static constexpr std::pair< std::vector< double >, std::vector< std::size_t > > mem_lin_comb(std::array< std::size_t, sizeof...(TensorIndex)> const &natural_ids)
static constexpr bool is_explicitely_stored_tensor
ddc::DiscreteDomain< TensorIndex... > subindices_domain_t
static constexpr bool is_tensor_index
static constexpr std::size_t access_size()
YoungTableau young_tableau
static constexpr std::pair< std::vector< double >, std::vector< std::size_t > > access_id_to_mem_lin_comb(std::size_t access_id)
static KOKKOS_FUNCTION constexpr Tensor::element_type process_access(const FunctorType &access, Tensor const &tensor, Elem const &elem)