16 #ifndef OPENKALMAN_SET_WRAPPED_COMPONENT_HPP 17 #define OPENKALMAN_SET_WRAPPED_COMPONENT_HPP 19 #include <type_traits> 24 #include "linear-algebra/coordinates/interfaces/coordinate_descriptor_traits.hpp" 45 template<pattern T, values::value X, values::index L>
48 requires requires(std::size_t i) { s(x, i); s(g(i), i); }
50 template<
typename T,
typename Setter,
typename Getter,
typename X,
typename L, std::enable_if_t<
51 pattern<T> and values::value<X> and values::index<L> and
53 std::is_invocable<const Setter&, typename std::invoke_result<const Getter&, std::size_t>::type, std::size_t>
::value,
int> = 0>
58 if constexpr (dimension_of_v<T> !=
dynamic_size and values::fixed<L>)
61 if constexpr (euclidean_pattern<T>)
65 else if constexpr (descriptor<T>)
71 using Scalar = std::decay_t<decltype(x)>;
72 auto component_ix =
collections::get(internal::get_index_table(t), local_index);
73 auto component = internal::get_descriptor_collection_element(t, component_ix);
74 auto start_i =
collections::get(internal::get_component_start_indices(t), component_ix);
75 auto new_g = [&g, start_i](
auto i) {
return g(
values::operation {std::plus{}, start_i, i}); };
76 auto new_s = [&s, start_i](
const Scalar& x,
auto i) { s(x,
values::operation {std::plus{}, start_i, i}); };
86 #endif //OPENKALMAN_SET_WRAPPED_COMPONENT_HPP Definition for coordinates::euclidean_pattern.
Definition for collections::get.
decltype(auto) constexpr get(Arg &&arg, I i)
A generalization of std::get.
Definition: get.hpp:62
An operation involving some number of values.
Definition: operation.hpp:69
constexpr void set_wrapped_component(const T &t, const Setter &s, const Getter &g, const X &x, const L &local_index)
Set a component and then perform any required wrapping.
Definition: set_wrapped_component.hpp:55
Definition for coordinates::internal::get_component_start_indices.
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
Definition for coordinates::pattern.
constexpr auto to_number(Arg arg)
Convert any values::value to a values::number.
Definition: to_number.hpp:34
Definition for coordinates::internal::get_index_table.
Definition for coordinates::descriptor.
Definition: compares_with.hpp:28
Traits for coordinates::pattern objects.
Definition: coordinate_descriptor_traits.hpp:41
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33
Definition for coordinates::dimension_of.