cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
broadcast.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_BROADCAST_H
4#define pRC_CORE_TENSOR_FUNCTIONS_BROADCAST_H
5
9
10namespace pRC
11{
12 template<Size... Bs, class X, IsTensorish R = RemoveReference<X>>
13 requires(sizeof...(Bs) == R::Dimension)
14 static inline constexpr auto broadcast(X &&a)
15 {
16 if constexpr(IsInvocable<View, X>)
17 {
19 return TensorViews::Broadcast<typename R::Type,
20 decltype(typename R::Sizes() * Sizes<Bs...>()), Sizes<Bs...>,
21 V>(view(forward<X>(a)));
22 }
23 else
24 {
25 return eval(broadcast<Bs...>(a));
26 }
27 }
28}
29#endif // pRC_CORE_TENSOR_FUNCTIONS_BROADCAST_H
Definition sequence.hpp:29
Definition broadcast.hpp:11
Definition concepts.hpp:31
Definition cholesky.hpp:10
std::size_t Size
Definition basics.hpp:31
std::remove_reference_t< T > RemoveReference
Definition basics.hpp:41
static constexpr decltype(auto) view(X &&a)
Definition view.hpp:13
static constexpr auto broadcast(X &&a)
Definition broadcast.hpp:14
static constexpr decltype(auto) eval(X &&a)
Definition eval.hpp:12