cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
direct_sum.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_DIRECT_SUM_H
4#define pRC_CORE_TENSOR_FUNCTIONS_DIRECT_SUM_H
5
10
11namespace pRC
12{
13 template<class XA, class XB, class RA = RemoveReference<XA>,
14 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
15 If<IsInvocable<View, XA>> = 0, If<IsTensorish<RB>> = 0,
16 If<IsInvocable<View, XB>> = 0,
17 If<IsSame<typename RA::Dimension, typename RB::Dimension>> = 0,
18 If<HasCommon<typename RA::Type, typename RB::Type>> = 0>
19 static inline constexpr auto directSum(XA &&a, XB &&b)
20 {
25 decltype(typename RA::Sizes() + typename RB::Sizes()), VA, VB>(
26 view(forward<XA>(a)), view(forward<XB>(b)));
27 }
28
29 template<class XA, class XB, class RA = RemoveReference<XA>,
30 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
31 If<IsTensorish<RB>> = 0,
32 If<Not<All<IsInvocable<View, XA>, IsInvocable<View, XB>>>> = 0,
33 If<IsInvocable<DirectSum, XA &, XB &>> = 0>
34 static inline constexpr auto directSum(XA &&a, XB &&b)
35 {
36 return eval(directSum(a, b));
37 }
38}
39#endif // pRC_CORE_TENSOR_FUNCTIONS_DIRECT_SUM_H
Definition direct_sum.hpp:14
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
typename CommonTypes< Ts... >::Type Common
Definition common.hpp:55
static constexpr auto directSum(XA &&a, XB &&b)
Definition direct_sum.hpp:19