cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
inflate.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_VIEWS_INFLATE_H
4#define pRC_CORE_TENSOR_VIEWS_INFLATE_H
5
7
8namespace pRC::TensorViews
9{
10 template<class T, class N, class B, class V>
11 class Inflate;
12
13 template<class T, class N, Size... Bs, class V>
14 requires IsTensorView<V>
15 class Inflate<T, N, Sizes<Bs...>, V>
16 : public View<T, N, Inflate<T, N, Sizes<Bs...>, V>>
17 {
18 private:
20
21 public:
22 template<class X>
24 Inflate(X &&a)
25 : mA(forward<X>(a))
26 {
27 }
28
29 template<IsConvertible<Index>... Is>
30 requires(sizeof...(Is) == Base::Dimension)
31 constexpr decltype(auto) operator()(Is const... indices)
32 {
33 return asConst(mA((indices / Bs)...));
34 }
35
36 template<IsConvertible<Index>... Is>
37 requires(sizeof...(Is) == Base::Dimension)
38 constexpr decltype(auto) operator()(Is const... indices) const
39 {
40 return mA((indices / Bs)...);
41 }
42
43 constexpr decltype(auto) operator()(
44 typename Base::Subscripts const &subscripts)
45 {
46 return this->call(subscripts);
47 }
48
49 constexpr decltype(auto) operator()(
50 typename Base::Subscripts const &subscripts) const
51 {
52 return this->call(subscripts);
53 }
54
55 constexpr decltype(auto) operator[](Index const index) = delete;
56 constexpr decltype(auto) operator[](Index const index) const = delete;
57
58 private:
59 V mA;
60 };
61}
62#endif // pRC_CORE_TENSOR_VIEWS_INFLATE_H
Definition value.hpp:12
Definition sequence.hpp:29
Definition inflate.hpp:11
Definition declarations.hpp:20
Definition concepts.hpp:28
Definition declarations.hpp:36
pRC::Float<> T
Definition externs_nonTT.hpp:1
Definition declarations.hpp:18
Size Index
Definition basics.hpp:32
std::size_t Size
Definition basics.hpp:31
static constexpr AddConst< X > & asConst(X &a)
Definition basics.hpp:71