cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
backwards.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_TENSOR_TRAIN_TENSOR_VIEWS_BACKWARDS_H
4#define pRC_TENSOR_TRAIN_TENSOR_VIEWS_BACKWARDS_H
5
9
11{
12 template<class T, class N, class Ranks, class V>
14 : public Conditional<IsAssignable<V>,
15 Assignable<T, N, Ranks, Backwards<T, N, Ranks, V>>,
16 View<T, N, Ranks, Backwards<T, N, Ranks, V>>>
17 {
18 static_assert(IsTensorView<V>());
19
20 private:
21 using Base = Conditional<IsAssignable<V>,
23
24 public:
25 template<class X, If<IsSame<V, RemoveReference<X>>> = 0>
27 : mA(forward<X>(a))
28 {
29 }
30
31 using Base::operator=;
32
33 template<Index C>
34 constexpr decltype(auto) core()
35 {
36 constexpr auto B = typename Base::Dimension() - C - 1;
37
38 return permute<2, 1, 0>(mA.template core<B>());
39 }
40
41 template<Index C>
42 constexpr decltype(auto) core() const
43 {
44 constexpr auto B = typename Base::Dimension() - C - 1;
45
46 return permute<2, 1, 0>(mA.template core<B>());
47 }
48
49 private:
50 V mA;
51 };
52}
53#endif // pRC_TENSOR_TRAIN_TENSOR_VIEWS_BACKWARDS_H
Definition type_traits.hpp:40
Definition backwards.hpp:17
Backwards(X &&a)
Definition backwards.hpp:26
constexpr decltype(auto) core() const
Definition backwards.hpp:42
constexpr decltype(auto) core()
Definition backwards.hpp:34
Definition type_traits.hpp:37
Definition type_traits.hpp:35
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
std::conditional_t< B{}, T, F > Conditional
Definition type_traits.hpp:131