cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
narrow.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_NARROW_H
4#define pRC_CORE_TENSOR_FUNCTIONS_NARROW_H
5
8
9namespace pRC
10{
11 template<Index... Ns, class F, class... Xs,
13 If<IsSame<decltype(chip<Ns...>(
14 typename RemoveReference<Xs>::Sizes()))...>> = 0,
15 If<True<decltype(chip<Ns...>(makeSeries<Index,
17 static inline constexpr auto narrow(F &&f, Xs &&...args)
18 {
19 return expand(
21 Common<typename RemoveReference<Xs>::Dimension...>{}>()),
22 [&f, &args...](auto const... seq)
23 {
24 return exclude<seq...>(forward<F>(f), forward<Xs>(args)...);
25 });
26 }
27
28 template<class F, Index... Ns, class... Xs,
30 If<IsSame<decltype(chip<Ns...>(
31 typename RemoveReference<Xs>::Sizes()))...>> = 0,
32 If<True<decltype(chip<Ns...>(makeSeries<Index,
34 static inline constexpr auto narrow(Xs &&...args)
35 {
36 return narrow<Ns...>(F(), forward<Xs>(args)...);
37 }
38}
39#endif // pRC_CORE_TENSOR_FUNCTIONS_NARROW_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
Size Index
Definition type_traits.hpp:21
typename CommonTypes< Ts... >::Type Common
Definition common.hpp:55
std::remove_reference_t< T > RemoveReference
Definition type_traits.hpp:56
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
static constexpr auto makeSeries()
Definition sequence.hpp:351
static constexpr auto chip(Sequence< T, Is... > const)
Definition sequence.hpp:551
static constexpr decltype(auto) expand(Sequence< T, Seq... > const, F &&f, Xs &&...args)
Definition sequence.hpp:344
static constexpr auto narrow(F &&f, Xs &&...args)
Definition narrow.hpp:17
static constexpr auto exclude(F &&f, Xs &&...args)
Definition exclude.hpp:24