SimiLie
Loading...
Searching...
No Matches
dummy_index.hpp
1// SPDX-FileCopyrightText: 2024 Baptiste Legouix
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include <ddc/ddc.hpp>
7
8#include <similie/misc/specialization.hpp>
9#include <similie/tensor/full_tensor.hpp>
10
11namespace sil {
12
13namespace tensor {
14
15// Dummy tag indexed by I
16template <std::size_t I>
17struct Dummy
18{
19};
20
21namespace detail {
22
23template <class Ids>
24struct NaturalIndex;
25
26template <std::size_t... Id>
27struct NaturalIndex<std::index_sequence<Id...>>
28{
29 template <std::size_t RankId>
30 struct type : tensor::TensorNaturalIndex<Dummy<Id>...>
31 {
32 };
33};
34
35template <class NaturalIds, class RankIds>
36struct DummyIndex;
37
38template <std::size_t... Id, std::size_t... RankId>
39struct DummyIndex<std::index_sequence<Id...>, std::index_sequence<RankId...>>
40{
41 using type = tensor::TensorFullIndex<
42 typename NaturalIndex<std::index_sequence<Id...>>::template type<RankId>...>;
43};
44
45} // namespace detail
46
47template <std::size_t Dimension, std::size_t Rank>
48using dummy_index_t = detail::
49 DummyIndex<std::make_index_sequence<Dimension>, std::make_index_sequence<Rank>>::type;
50
51} // namespace tensor
52
53} // namespace sil
detail:: DummyIndex< std::make_index_sequence< Dimension >, std::make_index_sequence< Rank > >::type dummy_index_t
The top-level namespace of SimiLie.
Definition csr.hpp:14