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_CORE_TENSOR_FUNCTIONS_BACKWARDS_H
4#define pRC_CORE_TENSOR_FUNCTIONS_BACKWARDS_H
5
7
8namespace pRC
9{
10 template<class X, class R = RemoveReference<X>, If<IsTensorish<R>> = 0,
11 If<IsInvocable<View, X>> = 0>
12 static inline constexpr auto backwards(X &&a)
13 {
14 return expand(reverse(makeSeries<Index, typename R::Dimension{}>()),
15 [&a](auto const... seq)
16 {
17 return permute<seq...>(forward<X>(a));
18 });
19 }
20
21 template<class X, class R = RemoveReference<X>, If<IsTensorish<R>> = 0,
22 If<Not<IsInvocable<View, X>>> = 0>
23 static inline constexpr auto backwards(X &&a)
24 {
25 return eval(backwards(a));
26 }
27}
28#endif // pRC_CORE_TENSOR_FUNCTIONS_BACKWARDS_H
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
Size Index
Definition type_traits.hpp:21
static constexpr auto reverse(Direction const D)
Definition direction.hpp:24
static constexpr auto makeSeries()
Definition sequence.hpp:351
static constexpr auto backwards(X &&a)
Definition backwards.hpp:12
static constexpr auto permute(Sequence< T, Is... > const)
Definition sequence.hpp:440
static constexpr decltype(auto) expand(Sequence< T, Seq... > const, F &&f, Xs &&...args)
Definition sequence.hpp:344