cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
outer_product.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_OUTER_PRODUCT_H
4#define pRC_CORE_TENSOR_FUNCTIONS_OUTER_PRODUCT_H
5
11
12namespace pRC
13{
14 template<class XA, class XB, class RA = RemoveReference<XA>,
15 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
16 If<IsInvocable<View, XA>> = 0, If<IsTensorish<RB>> = 0,
17 If<IsInvocable<View, XB>> = 0, If<IsInvocable<Conj, XA>> = 0,
18 If<IsInvocable<TensorProduct, XA, ResultOf<Conj, XB>>> = 0>
19 static inline constexpr auto outerProduct(XA &&a, XB &&b)
20 {
21 return tensorProduct(forward<XA>(a), conj(forward<XB>(b)));
22 }
23
24 template<class XA, class XB, class RA = RemoveReference<XA>,
25 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
26 If<IsTensorish<RB>> = 0,
27 If<Not<All<IsInvocable<View, XA>, IsInvocable<View, XB>>>> = 0,
28 If<IsInvocable<OuterProduct, XA &, XB &>> = 0>
29 static inline constexpr auto outerProduct(XA &&a, XB &&b)
30 {
31 return eval(outerProduct(a, b));
32 }
33}
34#endif // pRC_CORE_TENSOR_FUNCTIONS_OUTER_PRODUCT_H
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr auto outerProduct(XA &&a, XB &&b)
Definition outer_product.hpp:19
static constexpr auto tensorProduct(XA &&a, XB &&b)
Definition tensor_product.hpp:19
static constexpr auto conj(Complex< T > const &a)
Definition conj.hpp:11