pRC
multi-purpose Tensor Train library for C++
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_OPERATOR_VIEWS_BACKWARDS_H
4#define pRC_TENSOR_TRAIN_OPERATOR_VIEWS_BACKWARDS_H
5
9
11{
12 template<class T, class M, class N, class Ranks, class V>
14 : public Conditional<IsAssignable<V>,
15 Assignable<T, M, N, Ranks, Backwards<T, M, N, Ranks, V>>,
16 View<T, M, N, Ranks, Backwards<T, M, N, Ranks, V>>>
17 {
18 static_assert(IsOperatorView<V>());
19
20 private:
21 using Base =
24
25 public:
26 template<class X, If<IsSame<V, RemoveReference<X>>> = 0>
28 : mA(forward<X>(a))
29 {
30 }
31
32 using Base::operator=;
33
34 template<Index C>
35 constexpr decltype(auto) core()
36 {
37 constexpr auto B = typename Base::Dimension() - C - 1;
38
39 return permute<3, 1, 2, 0>(mA.template core<B>());
40 }
41
42 template<Index C>
43 constexpr decltype(auto) core() const
44 {
45 constexpr auto B = typename Base::Dimension() - C - 1;
46
47 return permute<3, 1, 2, 0>(mA.template core<B>());
48 }
49
50 private:
51 V mA;
52 };
53}
54#endif // pRC_TENSOR_TRAIN_OPERATOR_VIEWS_BACKWARDS_H
Definition type_traits.hpp:40
constexpr decltype(auto) core() const
Definition backwards.hpp:43
Backwards(X &&a)
Definition backwards.hpp:27
constexpr decltype(auto) core()
Definition backwards.hpp:35
Definition type_traits.hpp:37
Definition type_traits.hpp:35
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
std::conditional_t< B{}, T, F > Conditional
Definition type_traits.hpp:131