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);
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)),
65 internal::tuple_slice<0,
sizeof...(Factors) - 1>(std::forward_as_tuple(factors...))));
69 if constexpr ((... or values::dynamic<Factors>))
71 if ((... or (factors <= 0)))
throw std::invalid_argument {
"In broadcast, all factors must be positive"};
constexpr bool indexible
T is a multidimensional array type.
Definition: indexible.hpp:32
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
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
decltype(auto) constexpr apply(F &&f, T &&t)
A generalization of std::apply.
Definition: apply.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:42
Inclusion file for collections.
typename collection_element< i, T >::type collection_element_t
Helper template for collection_element.
Definition: collection_element.hpp:116
constexpr bool index
T is an index value.
Definition: index.hpp:62
Definition: broadcast.hpp:27