cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
permute.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_PERMUTE_H
4#define pRC_CORE_TENSOR_FUNCTIONS_PERMUTE_H
5
9
10namespace pRC
11{
12 template<Index... Ps, class X, IsTensorish R = RemoveReference<X>>
13 requires requires { permute<Ps...>(typename R::Sizes()); }
14 static inline constexpr auto permute(X &&a)
15 {
16 if constexpr(IsInvocable<View, X>)
17 {
19 return TensorViews::Permute<typename R::Type,
20 decltype(permute<Ps...>(typename R::Sizes())),
21 Sequence<Index, Ps...>, V>(view(forward<X>(a)));
22 }
23 else
24 {
25 return eval(permute<Ps...>(a));
26 }
27 }
28}
29#endif // pRC_CORE_TENSOR_FUNCTIONS_PERMUTE_H
Definition sequence.hpp:29
Definition permute.hpp:13
Definition concepts.hpp:31
Definition cholesky.hpp:10
Size Index
Definition basics.hpp:32
std::remove_reference_t< T > RemoveReference
Definition basics.hpp:41
static constexpr decltype(auto) view(X &&a)
Definition view.hpp:13
static constexpr auto permute(Sequence< T, Is... > const)
Definition sequence.hpp:487
static constexpr decltype(auto) eval(X &&a)
Definition eval.hpp:12