pRC
multi-purpose Tensor Train library for C++
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
27 template<Bool... Rs, class X, class R = RemoveReference<X>,
29 If<IsSatisfied<(sizeof...(Rs) == typename R::Dimension())>> = 0>
30 static inline constexpr auto reverse(X &&a)
31 {
33 return TensorViews::Reverse<typename R::Type, typename R::Sizes,
34 Sequence<Bool, Rs...>, V>(view(forward<X>(a)));
35 }
36
53 template<Bool... Rs, class X, class R = RemoveReference<X>,
55 If<IsInvocable<Reverse<Rs...>, X &>> = 0>
56 static inline constexpr auto reverse(X &&a)
57 {
58 return eval(reverse<Rs...>(a));
59 }
60}
61#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 X view(X &&a)
Returns a TensorView obtained from a TensorView.
Definition view.hpp:22
static constexpr auto reverse(Direction const D)
Definition direction.hpp:24
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
std::is_invocable< F, Args... > IsInvocable
Definition type_traits.hpp:134
Constant< Bool, B > IsSatisfied
Definition type_traits.hpp:71
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13