pRC
multi-purpose Tensor Train library for C++
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
28 template<class XA, class XB, class RA = RemoveReference<XA>,
29 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
30 If<IsInvocable<View, XA>> = 0, If<IsTensorish<RB>> = 0,
31 If<IsInvocable<View, XB>> = 0,
32 If<IsSame<typename RA::Dimension, typename RB::Dimension>> = 0,
33 If<HasCommon<typename RA::Type, typename RB::Type>> = 0>
34 static inline constexpr auto directSum(XA &&a, XB &&b)
35 {
40 decltype(typename RA::Sizes() + typename RB::Sizes()), VA, VB>(
42 }
43
61 template<class XA, class XB, class RA = RemoveReference<XA>,
62 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
63 If<IsTensorish<RB>> = 0,
64 If<Not<All<IsInvocable<View, XA>, IsInvocable<View, XB>>>> = 0,
65 If<IsInvocable<DirectSum, XA &, XB &>> = 0>
66 static inline constexpr auto directSum(XA &&a, XB &&b)
67 {
68 return eval(directSum(a, b));
69 }
70}
71#endif // pRC_CORE_TENSOR_FUNCTIONS_DIRECT_SUM_H
Definition direct_sum.hpp:14
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr X view(X &&a)
Returns a TensorView obtained from a TensorView.
Definition view.hpp:22
typename CommonTypes< Ts... >::Type Common
Definition common.hpp:55
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto directSum(XA &&a, XB &&b)
Calculates the direct sum of two Tensors.
Definition direct_sum.hpp:34