cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
reverse.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_REVERSE_H
4#define pRC_CORE_TENSOR_FUNCTIONS_REVERSE_H
5
8
9namespace pRC
10{
11 template<Bool... Rs>
12 struct Reverse;
13
14 template<Bool... Rs, class X, class R = RemoveReference<X>,
16 If<IsSatisfied<(sizeof...(Rs) == typename R::Dimension())>> = 0>
17 static inline constexpr auto reverse(X &&a)
18 {
20 return TensorViews::Reverse<typename R::Type, typename R::Sizes,
21 Sequence<Bool, Rs...>, V>(view(forward<X>(a)));
22 }
23
24 template<Bool... Rs, class X, class R = RemoveReference<X>,
26 If<IsInvocable<Reverse<Rs...>, X &>> = 0>
27 static inline constexpr auto reverse(X &&a)
28 {
29 return eval(reverse<Rs...>(a));
30 }
31}
32#endif // pRC_CORE_TENSOR_FUNCTIONS_REVERSE_H
Definition sequence.hpp:34
Definition reverse.hpp:12
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
bool Bool
Definition type_traits.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr X view(X &&a)
Definition view.hpp:12
static constexpr auto reverse(Direction const D)
Definition direction.hpp:24
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
Constant< Bool, B > IsSatisfied
Definition type_traits.hpp:71
std::is_invocable< F, Args... > IsInvocable
Definition type_traits.hpp:134