cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
add.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_TENSOR_TRAIN_TENSOR_FUNCTIONS_ADD_H
4#define pRC_TENSOR_TRAIN_TENSOR_FUNCTIONS_ADD_H
5
9
10namespace pRC
11{
12 template<class XA, class XB, class RA = RemoveReference<XA>,
13 class RB = RemoveReference<XB>, If<TensorTrain::IsTensorish<RA>> = 0,
14 If<TensorTrain::IsTensorish<RB>> = 0,
15 If<IsSame<typename RA::Sizes, typename RB::Sizes>> = 0,
16 If<HasCommon<typename RA::Type, typename RB::Type>> = 0>
17 static inline constexpr auto operator+(XA &&a, XB &&b)
18 {
19 return enumerate(
20 []<Index C>(auto &&...args) -> decltype(auto)
21 {
22 if constexpr(C == 0)
23 {
25 forward<decltype(args)>(args)...);
26 }
27 else if constexpr(C ==
29 1)
30 {
32 forward<decltype(args)>(args)...));
33 }
34 else
35 {
37 forward<decltype(args)>(args)...));
38 }
39 },
41 }
42}
43#endif // pRC_TENSOR_TRAIN_TENSOR_FUNCTIONS_ADD_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
Size Index
Definition type_traits.hpp:21
static constexpr auto enumerate(F &&f, Xs &&...args)
Definition enumerate.hpp:20
static constexpr auto operator+(Sequence< T, As... > const, Sequence< T, Bs... > const)
Definition sequence.hpp:110