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