8#include <similie/misc/permutation_parity.hpp>
10#include "tensor_impl.hpp"
17template <TensorNatIndex... TensorIndex>
28 ddc::DiscreteElement<
TensorIndex...>(ddc::DiscreteElement<TensorIndex>(0)...),
30 ddc::DiscreteVector<TensorIndex>(TensorIndex::size())...));
33 KOKKOS_FUNCTION
static constexpr std::size_t
rank()
35 return (TensorIndex::rank() + ...);
38 static_assert(((TensorIndex::size() ==
rank()) && ...));
40 KOKKOS_FUNCTION
static constexpr std::size_t
size()
42 return (TensorIndex::size() * ...);
45 KOKKOS_FUNCTION
static constexpr std::size_t
mem_size()
55 KOKKOS_FUNCTION
static constexpr std::size_t
mem_id(
56 std::array<std::size_t,
sizeof...(
TensorIndex)>
const natural_ids)
58 return std::numeric_limits<std::size_t>::max();
61 KOKKOS_FUNCTION
static constexpr std::size_t
access_id(
62 std::array<std::size_t,
sizeof...(
TensorIndex)>
const natural_ids)
64 if constexpr (
rank() == 1) {
70 }
else if (parity == 1) {
81 return std::numeric_limits<std::size_t>::max();
84 template <
class Tensor,
class Elem,
class Id,
class FunctorType>
86 const FunctorType& access,
90 if (elem.template uid<Id>() == 0) {
92 }
else if (elem.template uid<Id>() == 1) {
93 return access(tensor, elem);
95 return -access(tensor, elem);
99 KOKKOS_FUNCTION
static constexpr std::array<std::size_t,
rank()>
103 std::array<std::size_t,
rank()> ids;
104 for (
auto i = ids.begin(); i < ids.end(); ++i) {
constexpr int permutation_parity(std::array< std::size_t, N > lst)
Tensor(ddc::Chunk< ElementType, SupportType, Allocator >) -> Tensor< ElementType, SupportType, Kokkos::layout_right, typename Allocator::memory_space >
The top-level namespace of SimiLie.
static KOKKOS_FUNCTION 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 KOKKOS_FUNCTION constexpr subindices_domain_t subindices_domain()
static KOKKOS_FUNCTION constexpr std::size_t access_id_to_mem_id(std::size_t access_id)
static KOKKOS_FUNCTION constexpr std::size_t mem_id(std::array< std::size_t, sizeof...(TensorIndex)> const natural_ids)
static KOKKOS_FUNCTION constexpr std::size_t access_size()
static KOKKOS_FUNCTION constexpr Tensor::element_type process_access(const FunctorType &access, Tensor tensor, Elem elem)
static KOKKOS_FUNCTION constexpr std::size_t size()
static constexpr bool is_explicitely_stored_tensor
static KOKKOS_FUNCTION constexpr std::size_t mem_size()
ddc::DiscreteDomain< TensorIndex... > subindices_domain_t
static KOKKOS_FUNCTION constexpr std::array< std::size_t, rank()> mem_id_to_canonical_natural_ids(std::size_t mem_id)
static constexpr bool is_tensor_index