OpenKalman
coordinate_descriptor_traits.hpp
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2022-2025 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 
17 #ifndef OPENKALMAN_COORDINATE_DESCRIPTOR_TRAITS_HPP
18 #define OPENKALMAN_COORDINATE_DESCRIPTOR_TRAITS_HPP
19 
20 #include <typeindex>
22 
23 namespace OpenKalman::interface
24 {
31 #ifdef __cpp_concepts
32  template<typename T>
33 #else
34  template<typename T, typename = void>
35 #endif
37  {
38  static constexpr bool
39  is_specialized = false;
40 
41 #ifdef DOXYGEN_SHOULD_SKIP_THIS
42 
46  static constexpr auto
47  dimension = [](const T&) -> values::index auto { return std::integral_constant<std::size_t, 0_uz>{}; };
48 
49 
53  static constexpr auto
54  stat_dimension = [](const T&) noexcept -> values::index auto { return std::integral_constant<std::size_t, 0_uz>{}; };
55 
56 
61  static constexpr auto
62  is_euclidean = [](const T&) -> std::convertible_to<bool> auto { return std::false_type {}; };
63 
64 
70  static constexpr auto
71  hash_code = [](const T&) -> std::convertible_to<std::size_t> { return typeid(T).hash_code(); };
72 
73 
80  static constexpr auto
81  to_stat_space = [](const T& t, collections::collection_view auto&& data_view) -> collections::collection decltype(auto)
82  {
83  return collections::views::all(std::forward<decltype(data_view)>(data_view));
84  };
85 
86 
93  static constexpr auto
94  from_stat_space = [](const T& t, collections::collection_view auto&& data_view) -> collections::collection decltype(auto)
95  {
96  return collections::views::all(std::forward<decltype(data_view)>(data_view));
97  };
98 
99 
107  static constexpr auto
108  wrap = [](const T& t, collections::collection_view auto&& data_view) -> collections::collection decltype(auto)
109  {
110  return collections::views::all(std::forward<decltype(data_view)>(data_view));
111  };
112 
113 #endif
114 
115  };
116 
117 }
118 
119 
120 
121 #endif
constexpr bool collection
An object describing a collection of objects.
Definition: collection.hpp:32
Definition: basics.hpp:41
decltype(auto) constexpr to_stat_space(const T &t, R &&data_view)
Maps a range reflecting vector-space data to a corresponding range in a vector space for directional ...
Definition: to_stat_space.hpp:44
decltype(auto) constexpr wrap(const T &t, R &&data_view)
wraps a range reflecting vector-space data to its primary range.
Definition: wrap.hpp:59
constexpr detail::all_closure all
a std::ranges::range_adaptor_closure which returns a view to all members of its collection argument...
Definition: all.hpp:72
Inclusion file for collections.
constexpr bool collection_view
A view to a collection which is also a std::ranges:view.
Definition: collection_view.hpp:31
Traits for coordinates::pattern objects.
Definition: coordinate_descriptor_traits.hpp:36
constexpr bool index
T is an index value.
Definition: index.hpp:62
decltype(auto) constexpr from_stat_space(const T &t, R &&stat_data_view)
Maps a range in a vector space for directional-statistics back to a range reflecting vector-space dat...
Definition: from_stat_space.hpp:44