cMHN 1.2
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
9
10namespace pRC
11{
12 template<class XA, class XB, IsTensorish RA = RemoveReference<XA>,
13 IsTensorish RB = RemoveReference<XB>>
14 requires(RA::Dimension == RB::Dimension) &&
15 HasCommon<typename RA::Type, typename RB::Type>
16 static inline constexpr auto directSum(XA &&a, XB &&b)
17 {
19 {
24 decltype(typename RA::Sizes() + typename RB::Sizes()), VA, VB>(
25 view(forward<XA>(a)), view(forward<XB>(b)));
26 }
27 else
28 {
29 return eval(directSum(a, b));
30 }
31 }
32}
33#endif // pRC_CORE_TENSOR_FUNCTIONS_DIRECT_SUM_H
Definition value.hpp:12
Definition direct_sum.hpp:15
Definition concepts.hpp:31
pRC::Float<> T
Definition externs_nonTT.hpp:1
Definition cholesky.hpp:10
std::remove_reference_t< T > RemoveReference
Definition basics.hpp:41
static constexpr decltype(auto) view(X &&a)
Definition view.hpp:13
static constexpr auto directSum(XA &&a, XB &&b)
Definition direct_sum.hpp:16
std::common_type_t< Ts... > Common
Definition basics.hpp:53
static constexpr decltype(auto) eval(X &&a)
Definition eval.hpp:12