16 #ifndef OPENKALMAN_BROADCAST_HPP 17 #define OPENKALMAN_BROADCAST_HPP 23 #ifndef __cpp_concepts 26 template<
typename Factor,
typename =
void>
29 template<
typename Factor>
30 struct FactorIs1<Factor,
std::enable_if_t<Factor::value == 1>> : std::true_type {};
46 template<
typename Arg,
typename...Factors, std::enable_if_t<indexible<Arg> and (... and values::index<Factors>),
int> = 0>
47 constexpr decltype(
auto)
51 if constexpr (
sizeof...(Factors) == 0)
53 return std::forward<Arg>(arg);
56 else if constexpr (requires { requires std::tuple_element_t<
sizeof...(Factors) - 1, std::tuple<Factors...>>::
value == 1; })
63 [](Arg&& arg,
const auto&...fs) {
return broadcast(std::forward<Arg>(arg), fs...); },
64 collections::views_concat(std::forward_as_tuple(std::forward<Arg>(arg)),
69 if constexpr ((... or values::dynamic<Factors>))
71 if ((... or (factors <= 0)))
throw std::invalid_argument {
"In broadcast, all factors must be positive"};
82 #endif //OPENKALMAN_BROADCAST_HPP Definition of collections::concat_tuple_view and collections::views::concat.
Definition: broadcast.hpp:27
constexpr bool indexible
T is a generalized tensor type.
Definition: indexible.hpp:32
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
decltype(auto) constexpr broadcast(Arg &&arg, const Factors &...factors)
Broadcast an object by replicating it by factors specified for each index.
Definition: broadcast.hpp:49
The root namespace for OpenKalman.
Definition: basics.hpp:34
An interface to various routines from the linear algebra library associated with indexible object T...
Definition: library_interface.hpp:37
constexpr bool index
T is an index value.
Definition: index.hpp:56
constexpr auto tuple_slice(Arg &&arg)
Takes a slice of a tuple, given an index range.
Definition: tuple_slice.hpp:132