SimiLie
Loading...
Searching...
No Matches
prime.hpp
1// SPDX-FileCopyrightText: 2024 Baptiste Legouix
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4#pragma once
5
6#include <ddc/ddc.hpp>
7
8#include <similie/misc/specialization.hpp>
9#include <similie/tensor/tensor_indices/character.hpp>
10
11namespace sil {
12
13namespace tensor {
14
15template <TensorNatIndex Index, std::size_t I = 1>
16struct prime : Index
17{
18};
19
20template <TensorNatIndex Index>
22
23namespace detail {
24
25template <class Indices, std::size_t I>
26struct Primes;
27
28template <std::size_t I>
29struct Primes<ddc::TypeSeq<>, I>
30{
31 using type = ddc::TypeSeq<>;
32};
33
34template <class... Index, std::size_t I>
35struct Primes<ddc::TypeSeq<Index...>, I>
36{
37 using type = ddc::TypeSeq<prime<Index, I>...>;
38};
39
40template <class... Index, std::size_t I>
41struct Primes<ddc::TypeSeq<Contravariant<Index>...>, I>
42{
43 using type = ddc::TypeSeq<Contravariant<prime<Index, I>>...>;
44};
45
46template <class... Index, std::size_t I>
47struct Primes<ddc::TypeSeq<Covariant<Index>...>, I>
48{
49 using type = ddc::TypeSeq<Covariant<prime<Index, I>>...>;
50};
51
52} // namespace detail
53
54template <misc::Specialization<ddc::TypeSeq> Indices, std::size_t I = 1>
55using primes = detail::Primes<Indices, I>::type;
56
57template <misc::Specialization<ddc::TypeSeq> Indices>
59
60} // namespace tensor
61
62} // namespace sil
detail::Primes< Indices, I >::type primes
Definition prime.hpp:55
primes< Indices, 2 > seconds
Definition prime.hpp:58
The top-level namespace of SimiLie.
Definition csr.hpp:15