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