11 #ifndef OPENKALMAN_VECTORSPACEADAPTER_HPP 12 #define OPENKALMAN_VECTORSPACEADAPTER_HPP 17 template<indexible NestedObject, pattern_collection Descriptors> requires
18 internal::not_more_fixed_than<NestedObject, Descriptors> and (not internal::less_fixed_than<NestedObject, Descriptors>) and
19 internal::maybe_same_shape_as_vector_space_descriptors<NestedObject, Descriptors>
21 template<
typename NestedObject,
typename Descriptors>
23 struct VectorSpaceAdapter : internal::AdapterBase<VectorSpaceAdapter<NestedObject, Descriptors>, NestedObject>
27 #ifndef __cpp_concepts 28 static_assert(indexible<NestedObject>);
29 static_assert(pattern_collection<Descriptors>);
30 static_assert(internal::not_more_fixed_than<NestedObject, Descriptors>);
31 static_assert(not internal::less_fixed_than<NestedObject, Descriptors>);
32 static_assert(internal::maybe_same_shape_as_vector_space_descriptors<NestedObject, Descriptors>);
35 using Base = internal::AdapterBase<VectorSpaceAdapter, NestedObject>;
44 fixed_pattern_tuple<Descriptors>
47 and fixed_pattern_tuple<Descriptors>,
int> = 0>
50 :
Base {}, my_descriptors{} {}
59 template<
internal::maybe_same_shape_as_vector_space_descriptors<Descriptors> Arg> requires
60 (not internal::vector_space_adapter<Arg>) and std::constructible_from<Base, Arg&&>
62 template<
typename Arg,
typename...Ds, std::enable_if_t<
63 internal::maybe_same_shape_as_vector_space_descriptors<Arg, Descriptors> and
64 (not internal::vector_space_adapter<Arg>) and std::is_constructible_v<Base, Arg&&>,
int> = 0>
67 :
Base {std::forward<Arg>(arg)}, my_descriptors {descriptors} {}
75 template<
internal::maybe_same_shape_as_vector_space_descriptors<Descriptors> Arg> requires
76 internal::vector_space_adapter<Arg> and std::constructible_from<Base, nested_object_of_t<Arg&&>>
78 template<
typename Arg, std::enable_if_t<
79 internal::maybe_same_shape_as_vector_space_descriptors<Arg, Descriptors> and
80 internal::maybe_same_shape_as_vector_space_descriptors<Arg, Descriptors> and
81 internal::vector_space_adapter<Arg> and std::is_constructible_v<Base, typename nested_object_of<Arg&&>::type>,
int> = 0>
91 template<
internal::maybe_same_shape_as_vector_space_descriptors<Descriptors> Arg> requires
93 std::assignable_from<std::add_lvalue_reference_t<NestedObject>, Arg&&> and
97 template<
typename Arg, std::enable_if_t<
98 (not std::is_base_of_v<VectorSpaceAdapter, std::decay_t<Arg>>) and
99 internal::maybe_same_shape_as_vector_space_descriptors<Arg, Descriptors> and
100 std::is_assignable_v<std::add_lvalue_reference_t<NestedObject>, Arg&&> and
113 #ifdef __cpp_concepts 117 template<
typename B =
Base,
typename = std::void_t<
118 decltype(std::declval<Base&>() += std::declval<const VectorSpaceAdapter&>().
nested_object())>>
122 Base::operator+=(other.nested_object());
128 #ifdef __cpp_concepts 132 template<
typename B =
Base,
typename = std::void_t<
133 decltype(std::declval<Base&>() -= std::declval<const VectorSpaceAdapter&>().
nested_object())>>
137 Base::operator-=(other.nested_object());
144 std::decay_t<Descriptors> my_descriptors;
156 #ifdef __cpp_concepts 157 template<indexible Arg, pattern_collection Descriptors> requires (not internal::vector_space_adapter<Arg>)
159 template<
typename Arg,
typename...Vs, std::enable_if_t<indexible<Arg> and pattern_collection<Descriptors> and
160 (not internal::vector_space_adapter<Arg>),
int> = 0>
166 #ifdef __cpp_concepts 167 template<
internal::vector_space_adapter Arg, pattern_collection Descriptors>
169 template<
typename Arg,
typename...Vs, std::enable_if_t<
170 internal::vector_space_adapter<Arg> and pattern_collection<Descriptors>,
int> = 0>
179 #endif //OPENKALMAN_VECTORSPACEADAPTER_HPP constexpr auto count_indices(const T &t)
Get the number of indices available to address the components of an indexible object.
Definition: count_indices.hpp:33
constexpr NestedObject & nested_object() &
Get the nested object.
Definition: AdapterBase.hpp:97
An adapter that adds vector space descriptors for each index.
Definition: forward-class-declarations.hpp:301
Definition: indexible_object_traits.hpp:36
constexpr AdapterBase & operator=(Arg &&arg)
Assign from another compatible indexible object.
Definition: AdapterBase.hpp:82
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
Definition: AdapterBase.hpp:36
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
auto & operator+=(const VectorSpaceAdapter &other)
Increment from another VectorSpaceAdapter.
Definition: VectorSpaceAdapter.hpp:119
constexpr VectorSpaceAdapter(Arg &&arg, const std::decay_t< Descriptors > &descriptors)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: VectorSpaceAdapter.hpp:83
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 VectorSpaceAdapter(Arg &&arg, const std::decay_t< Descriptors > &descriptors)
Construct from a compatible indexible object.
Definition: VectorSpaceAdapter.hpp:66
auto & operator-=(const VectorSpaceAdapter &other)
Decrement from another VectorSpaceAdapter.
Definition: VectorSpaceAdapter.hpp:134
constexpr bool fixed
T is a values::value that is determinable at compile time.
Definition: fixed.hpp:60
constexpr VectorSpaceAdapter()
Default constructor.
Definition: VectorSpaceAdapter.hpp:48