cMHN 1.2
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, IsTensorish R = RemoveReference<X>>
12 requires(R::Dimension > 0 && isEven(R::Dimension))
13 static inline constexpr auto matricize(X &&a)
14 {
15 return reshape<decltype(cut<2, 0>(typename R::Sizes()))::size(),
16 decltype(cut<2, 1>(typename R::Sizes()))::size()>(forward<X>(a));
17 }
18}
19#endif // pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_MATRICIZE_H
Definition cholesky.hpp:10
static constexpr auto isEven(T const a)
Definition is_even.hpp:11
static constexpr auto reshape(X &&a)
Definition reshape.hpp:14
static constexpr auto matricize(X &&a)
Definition matricize.hpp:13
static constexpr auto cut(Sequence< T, Is... > const)
Definition sequence.hpp:631