cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
kronecker_product.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_KRONECKER_PRODUCT_H
4#define pRC_CORE_TENSOR_FUNCTIONS_KRONECKER_PRODUCT_H
5
8
9namespace pRC
10{
11 template<class XA, class XB, IsTensorish RA = RemoveReference<XA>,
12 IsTensorish RB = RemoveReference<XB>>
13 requires(RA::Dimension == RB::Dimension) &&
14 IsInvocable<Mul, ResultOf<XA, typename RA::Subscripts>,
15 ResultOf<XB, typename RB::Subscripts>>
16 static inline constexpr auto kroneckerProduct(XA &&a, XB &&b)
17 {
19 [&a, &b](auto const... seq)
20 {
21 return hadamardProduct(
22 inflate<RB::size(seq)...>(forward<XA>(a)),
23 broadcast<RA::size(seq)...>(forward<XB>(b)));
24 });
25 }
26}
27#endif // pRC_CORE_TENSOR_FUNCTIONS_KRONECKER_PRODUCT_H
Definition cholesky.hpp:10
static constexpr auto kroneckerProduct(XA &&a, XB &&b)
Definition kronecker_product.hpp:16
static constexpr auto hadamardProduct(XA &&a, XB &&b)
Definition hadamard_product.hpp:15
static constexpr auto makeSeries()
Definition sequence.hpp:390
static constexpr auto broadcast(X &&a)
Definition broadcast.hpp:14
static constexpr decltype(auto) expand(Sequence< T, Seq... > const, F &&f, Xs &&...args)
Definition sequence.hpp:383
static constexpr auto inflate(X &&a)
Definition inflate.hpp:14