cMHN 1.1
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 class Inflate<T, N, Sizes<Bs...>, V>
15 : public View<T, N, Inflate<T, N, Sizes<Bs...>, V>>
16 {
17 static_assert(IsTensorView<V>());
18
19 private:
21
22 public:
23 template<class X, If<IsSame<V, RemoveReference<X>>> = 0>
25 : mA(forward<X>(a))
26 {
27 }
28
29 template<class... Is, If<All<IsConvertible<Is, Index>...>> = 0,
30 If<IsSatisfied<(sizeof...(Is) == typename Base::Dimension())>> = 0>
31 constexpr decltype(auto) operator()(Is const... indices)
32 {
33 return asConst(mA((indices / Bs)...));
34 }
35
36 template<class... Is, If<All<IsConvertible<Is, Index>...>> = 0,
37 If<IsSatisfied<(sizeof...(Is) == typename Base::Dimension())>> = 0>
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 private:
56 V mA;
57 };
58}
59#endif // pRC_CORE_TENSOR_VIEWS_INFLATE_H
Definition sequence.hpp:56
constexpr decltype(auto) operator()(Is const ... indices)
Definition inflate.hpp:31
constexpr decltype(auto) operator()(Is const ... indices) const
Definition inflate.hpp:38
Definition inflate.hpp:11
Definition type_traits.hpp:32
pRC::Float<> T
Definition externs_nonTT.hpp:1
Definition diagonal.hpp:11
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
std::size_t Size
Definition type_traits.hpp:20
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
Constant< Bool, B > IsSatisfied
Definition type_traits.hpp:71
AddConst< T > & asConst(T &a)
Definition type_traits.hpp:208