OpenKalman
compatible_with_vector_space_descriptor_collection.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2019-2024 Christopher Lee Ogden <ogden@gatech.edu>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
9  */
10 
16 #ifndef OPENKALMAN_COMPATIBLE_WITH_VECTOR_SPACE_DESCRIPTOR_COLLECTION_HPP
17 #define OPENKALMAN_COMPATIBLE_WITH_VECTOR_SPACE_DESCRIPTOR_COLLECTION_HPP
18 
19 
20 namespace OpenKalman
21 {
22  namespace detail
23  {
24  template<typename T, std::size_t N, std::size_t...Ix>
25  constexpr bool compatible_extension(std::index_sequence<Ix...>)
26  {
27  return (... and (compares_with<vector_space_descriptor_of_t<T, N + Ix>, coordinates::Dimensions<1>, equal_to<>, Applicability::permitted>));
28  }
29 
30 
31  template<typename T, typename D, std::size_t...Ix>
32  constexpr bool is_compatible_descriptor_tuple(std::index_sequence<Ix...>)
33  {
34  constexpr std::size_t N = sizeof...(Ix);
35  constexpr bool Dsmatch = (... and (compares_with<vector_space_descriptor_of_t<T, Ix>, std::tuple_element_t<Ix, D>, equal_to<>, Applicability::permitted>));
36 
37  if constexpr (index_count_v<T> != dynamic_size and N < index_count_v<T>)
38  return Dsmatch and compatible_extension<T, N>(std::make_index_sequence<index_count_v<T> - N>{});
39  else
40  return Dsmatch;
41  }
42 
43 
44 #ifdef __cpp_concepts
45  template<typename T, typename D>
46 #else
47  template<typename T, typename D, typename = void>
48 #endif
50 
51 
52 #ifdef __cpp_concepts
53  template<typename T, pattern_tuple D>
55 #else
56  template<typename T, typename D>
58  pattern_tuple<D>>>
59 #endif
60  : std::bool_constant<is_compatible_descriptor_tuple<T, D>(std::make_index_sequence<std::tuple_size_v<D>>{})> {};
61 
62  } // namespace detail
63 
64 
70  template<typename T, typename D>
71 #ifdef __cpp_concepts
73 #else
74  constexpr bool compatible_with_vector_space_descriptor_collection =
75 #endif
76  indexible<T> and pattern_collection<D> and
78 
79 
80 } // namespace OpenKalman
81 
82 #endif //OPENKALMAN_COMPATIBLE_WITH_VECTOR_SPACE_DESCRIPTOR_COLLECTION_HPP
Definition: tuple_reverse.hpp:103
The root namespace for OpenKalman.
Definition: basics.hpp:34
The concept, trait, or restraint is permitted, but whether it applies is not necessarily known at com...
constexpr bool compatible_with_vector_space_descriptor_collection
indexible T is compatible with pattern_collection D.
Definition: compatible_with_vector_space_descriptor_collection.hpp:74
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33
Definition: compatible_with_vector_space_descriptor_collection.hpp:49