16 #ifndef OPENKALMAN_ASSIGN_HPP 17 #define OPENKALMAN_ASSIGN_HPP 23 template<
typename M,
typename Arg,
typename...J>
24 static void copy_tensor_elements(M& m, Arg&& arg, std::index_sequence<>, J...j)
30 template<
typename M,
typename Arg, std::size_t I, std::size_t...Is,
typename...J>
31 static void copy_tensor_elements(M& m, Arg&& arg, std::index_sequence<I, Is...>, J...j)
33 for (std::size_t i = 0; i < get_index_dimension_of<I>(arg); i++)
34 copy_tensor_elements(m, std::forward<Arg>(arg), std::index_sequence<Is...> {}, j..., i);
46 template<indexible To, vector_space_descriptors_may_match_with<To> From>
48 template<
typename To,
typename From, std::enable_if_t<indexible<To> and vector_space_descriptors_may_match_with<From, To>,
int> = 0>
53 if constexpr (interface::assign_defined_for<To, std::add_lvalue_reference_t<To>, From&&>)
57 else if constexpr (interface::assign_defined_for<To, std::add_lvalue_reference_t<To>, decltype(to_native_matrix<To>(std::declval<From&&>()))>)
61 else if constexpr (std::is_assignable_v<std::add_lvalue_reference_t<To>, From&&>)
63 a = std::forward<From>(b);
65 else if constexpr (std::is_assignable_v<std::add_lvalue_reference_t<To>, decltype(to_native_matrix<To>(std::declval<From&&>()))>)
67 a = to_native_matrix<To>(std::forward<From>(b));
72 detail::copy_tensor_elements(a, std::forward<From>(b), std::make_index_sequence<index_count_v<To>>{});
74 return std::forward<To>(a);
80 #endif //OPENKALMAN_ASSIGN_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
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 To && assign(To &&a, From &&b)
Assign a writable object from an indexible object.
Definition: assign.hpp:51
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