cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
flatten.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_FLATTEN_H
4#define pRC_CORE_TENSOR_FUNCTIONS_FLATTEN_H
5
8
9namespace pRC
10{
11 template<Index K, class X, IsTensorish R = RemoveReference<X>>
12 requires(K < R::Dimension)
13 static inline constexpr auto flatten(X &&a)
14 {
16 [&a](auto const... seq)
17 {
18 return reshape<R::size(K),
19 decltype(chip<K>(typename R::Sizes()))::size()>(
20 permute<K, seq...>(forward<X>(a)));
21 });
22 }
23}
24#endif // pRC_CORE_TENSOR_FUNCTIONS_FLATTEN_H
Definition cholesky.hpp:10
static constexpr auto reshape(X &&a)
Definition reshape.hpp:14
static constexpr auto flatten(X &&a)
Definition flatten.hpp:13
static constexpr auto makeSeries()
Definition sequence.hpp:390
static constexpr auto chip(Sequence< T, Is... > const)
Definition sequence.hpp:584
static constexpr auto permute(Sequence< T, Is... > const)
Definition sequence.hpp:487
static constexpr decltype(auto) expand(Sequence< T, Seq... > const, F &&f, Xs &&...args)
Definition sequence.hpp:383