cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
loop.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_LOOP_H
4#define pRC_CORE_TENSOR_FUNCTIONS_LOOP_H
5
10
11namespace pRC
12{
13 template<class F>
14 struct Loop;
15
16 template<class F, class... Xs,
22 static inline constexpr auto loop(F &&f, Xs &&...args)
23 {
26
27 return TensorViews::Loop<T,
30 forward<F>(f), view(forward<Xs>(args))...);
31 }
32
33 template<class F, class... Xs,
39 static inline constexpr auto loop(Xs &&...args)
40 {
41 return loop(F(), forward<Xs>(args)...);
42 }
43
44 template<class F, class... Xs,
47 If<IsInvocable<Loop<F>, F, Xs &...>> = 0>
48 static inline constexpr auto loop(F &&f, Xs &&...args)
49 {
50 return eval(loop(forward<F>(f), args...));
51 }
52
53 template<class F, class... Xs,
56 If<IsInvocable<Loop<F>, Xs &...>> = 0>
57 static inline constexpr auto loop(Xs &&...args)
58 {
59 return eval(loop<F>(args...));
60 }
61}
62#endif // pRC_CORE_TENSOR_FUNCTIONS_LOOP_H
Definition loop.hpp:18
pRC::Float<> T
Definition externs_nonTT.hpp:1
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr X view(X &&a)
Definition view.hpp:12
std::invoke_result_t< F, Args... > ResultOf
Definition type_traits.hpp:140
typename CommonTypes< Ts... >::Type Common
Definition common.hpp:55
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
static constexpr auto loop(F &&f, Xs &&...args)
Definition loop.hpp:22
RemoveConst< RemoveReference< T > > RemoveConstReference
Definition type_traits.hpp:62
std::is_invocable< F, Args... > IsInvocable
Definition type_traits.hpp:134