16 #ifndef OPENKALMAN_SET_SLICE_HPP 17 #define OPENKALMAN_SET_SLICE_HPP 23 template<
typename Arg,
typename Block,
typename BeginTup,
typename...J>
24 static void assign_slice_elements(Arg& arg, Block&& block,
const BeginTup& begin_tup,
std::index_sequence<>, J...j)
26 set_component(arg, get_component(std::forward<Block>(block), std::get<0>(j)...), std::get<1>(j)...);
30 template<
typename Arg,
typename Block,
typename BeginTup, std::size_t I, std::size_t...Is,
typename...J>
33 for (std::size_t i = 0; i < get_index_dimension_of<I>(block); i++)
34 assign_slice_elements(arg, std::forward<Block>(block), begin_tup,
std::index_sequence<Is...>{}, j...,
35 std::tuple{i, std::get<I>(begin_tup) + i});
50 template<writable Arg,
indexible Block,
values::index...Begin> requires (
sizeof...(Begin) >= index_count_v<Arg>)
52 template<
typename Arg,
typename Block,
typename...Begin, std::enable_if_t<writable<Arg> and indexible<Block> and
56 set_slice(Arg&& arg, Block&& block,
const Begin&...begin)
58 std::index_sequence_for<Begin...> begin_seq;
59 internal::check_block_limits(begin_seq, begin_seq, arg, std::tuple{begin...});
60 internal::check_block_limits(begin_seq, begin_seq, arg, std::tuple{begin...},
62 return std::forward_as_tuple(
get_dimension(std::forward<decltype(a)>(a))...);
63 }, all_vector_space_descriptors(block)));
65 if constexpr (interface::set_slice_defined_for<Arg, Arg&, Block&&, const Begin&...>)
69 else if constexpr (interface::set_slice_defined_for<Arg, Arg&, decltype(to_native_matrix<Arg>(std::declval<Block&&>())),
const Begin&...>)
76 std::make_index_sequence<
sizeof...(Begin)> seq;
77 detail::assign_slice_elements(arg, std::forward<Block>(block), std::forward_as_tuple(begin...), seq);
79 return std::forward<Arg>(arg);
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 apply(F &&f, T &&t)
A generalization of std::apply.
Definition: apply.hpp:49
constexpr auto get_dimension(const Arg &arg)
Get the vector dimension of coordinates::pattern Arg.
Definition: get_dimension.hpp:54
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
Definition: trait_backports.hpp:64
constexpr bool index
T is an index value.
Definition: index.hpp:62
constexpr Arg && set_slice(Arg &&arg, Block &&block, const Begin &...begin)
Assign an object to a particular slice of a matrix or tensor.
Definition: set_slice.hpp:56