cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
tensor_product.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_TENSOR_PRODUCT_H
4#define pRC_CORE_TENSOR_FUNCTIONS_TENSOR_PRODUCT_H
5
9
10namespace pRC
11{
12 template<class XA, class XB, class RA = RemoveReference<XA>,
13 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
14 If<IsInvocable<View, XA>> = 0, If<IsTensorish<RB>> = 0,
15 If<IsInvocable<View, XB>> = 0,
16 class EA = ResultOf<XA, typename RA::Subscripts>,
17 class EB = ResultOf<XB, typename RB::Subscripts>,
18 If<IsInvocable<Mul, EA, EB>> = 0>
19 static inline constexpr auto tensorProduct(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<TensorProduct, XA &, XB &>> = 0>
34 static inline constexpr auto tensorProduct(XA &&a, XB &&b)
35 {
36 return eval(tensorProduct(a, b));
37 }
38}
39#endif // pRC_CORE_TENSOR_FUNCTIONS_TENSOR_PRODUCT_H
Definition tensor_product.hpp:13
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
RemoveConst< RemoveReference< T > > RemoveConstReference
Definition type_traits.hpp:62
static constexpr auto tensorProduct(XA &&a, XB &&b)
Definition tensor_product.hpp:19