cMHN 1.2
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
8
10{
11 template<class T, class N, class Ranks, class V>
12 requires IsTensorView<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 private:
21
22 public:
23 template<class X>
25 Backwards(X &&a)
26 : mA(forward<X>(a))
27 {
28 }
29
30 using Base::operator=;
31
32 template<Index C>
33 constexpr decltype(auto) core()
34 {
35 constexpr auto B = Base::Dimension - C - 1;
36
37 return permute<2, 1, 0>(mA.template core<B>());
38 }
39
40 template<Index C>
41 constexpr decltype(auto) core() const
42 {
43 constexpr auto B = Base::Dimension - C - 1;
44
45 return permute<2, 1, 0>(mA.template core<B>());
46 }
47
48 private:
49 V mA;
50 };
51}
52#endif // pRC_TENSOR_TRAIN_TENSOR_VIEWS_BACKWARDS_H
Definition gtest_unittest.cc:5120
Definition assignable.hpp:13
Definition backwards.hpp:17
constexpr decltype(auto) core() const
Definition backwards.hpp:41
Backwards(X &&a)
Definition backwards.hpp:25
constexpr decltype(auto) core()
Definition backwards.hpp:33
Definition declarations.hpp:21
Definition concepts.hpp:28
Definition declarations.hpp:19
static constexpr auto permute(Sequence< T, Is... > const)
Definition sequence.hpp:487
std::conditional_t< B, T, F > Conditional
Definition basics.hpp:56