cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
unfolding.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_UNFOLDING_H
4#define pRC_CORE_TENSOR_FUNCTIONS_UNFOLDING_H
5
8
9namespace pRC
10{
11 template<Index K, class X, class R = RemoveReference<X>,
12 If<IsTensorish<R>> = 0,
13 If<IsSatisfied<(typename R::Dimension{} > 1)>> = 0,
14 If<IsSatisfied<(K + 1 < typename R::Dimension{})>> = 0,
15 If<IsInvocable<Reshape<R::size(K), R::Sizes::size() / R::size(K)>, X>> =
16 0>
17 static inline constexpr auto unfolding(X &&a)
18 {
19 return reshape<decltype(trim<0, K + 1>(typename R::Sizes()))::size(),
20 decltype(trim<K + 1, typename R::Dimension{}>(
21 typename R::Sizes{}))::size()>(forward<X>(a));
22 }
23}
24#endif // pRC_CORE_TENSOR_FUNCTIONS_UNFOLDING_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
Constant< Bool, B > IsSatisfied
Definition type_traits.hpp:71
static constexpr auto trim(Sequence< T, Is... > const)
Definition sequence.hpp:613
static constexpr auto unfolding(X &&a)
Definition unfolding.hpp:17
std::is_invocable< F, Args... > IsInvocable
Definition type_traits.hpp:134