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)
30 template<
typename Arg,
typename Block,
typename BeginTup, std::size_t I, std::size_t...Is,
typename...J>
31 static void assign_slice_elements(Arg& arg, Block&& block,
const BeginTup& begin_tup, std::index_sequence<I, Is...>, J...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...},
61 std::apply([](
auto&&...a) -> decltype(
auto) {
62 return std::forward_as_tuple(get_dimension(std::forward<decltype(a)>(a))...);
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);
85 #endif //OPENKALMAN_SET_SLICE_HPP Arg && set_component(Arg &&arg, const scalar_type_of_t< Arg > &s, const Indices &indices)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: set_component.hpp:51
constexpr bool indexible
T is a generalized tensor type.
Definition: indexible.hpp:32
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
decltype(auto) constexpr all_vector_space_descriptors(const T &t)
Return a collection of coordinates::pattern objects associated with T.
Definition: all_vector_space_descriptors.hpp:52
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
decltype(auto) constexpr get_component(Arg &&arg, const Indices &indices)
Get a component of an object at a particular set of indices.
Definition: get_component.hpp:54
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