SimiLie
Loading...
Searching...
No Matches
prime.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
10#include "character.hpp"
11
12namespace sil {
13
14namespace tensor {
15
16template <TensorNatIndex Index, std::size_t I = 1>
17struct prime : Index
18{
19};
20
21template <TensorNatIndex Index>
23
24namespace detail {
25
26template <class Indices, std::size_t I>
27struct Primes;
28
29template <std::size_t I>
30struct Primes<ddc::detail::TypeSeq<>, I>
31{
32 using type = ddc::detail::TypeSeq<>;
33};
34
35template <class... Index, std::size_t I>
36struct Primes<ddc::detail::TypeSeq<Index...>, I>
37{
38 using type = ddc::detail::TypeSeq<prime<Index, I>...>;
39};
40
41template <class... Index, std::size_t I>
42struct Primes<ddc::detail::TypeSeq<Contravariant<Index>...>, I>
43{
44 using type = ddc::detail::TypeSeq<Contravariant<prime<Index, I>>...>;
45};
46
47template <class... Index, std::size_t I>
48struct Primes<ddc::detail::TypeSeq<Covariant<Index>...>, I>
49{
50 using type = ddc::detail::TypeSeq<Covariant<prime<Index, I>>...>;
51};
52
53} // namespace detail
54
55template <misc::Specialization<ddc::detail::TypeSeq> Indices, std::size_t I = 1>
56using primes = detail::Primes<Indices, I>::type;
57
58template <misc::Specialization<ddc::detail::TypeSeq> Indices>
60
61} // namespace tensor
62
63} // namespace sil
detail::Primes< Indices, I >::type primes
Definition prime.hpp:56
primes< Indices, 2 > seconds
Definition prime.hpp:59
The top-level namespace of SimiLie.
Definition csr.hpp:15