OpenKalman
indexible_object_traits.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) 2022-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_INDEXIBLE_OBJECT_TRAITS_HPP
17 #define OPENKALMAN_INDEXIBLE_OBJECT_TRAITS_HPP
18 
19 #include <type_traits>
20 #include <tuple>
21 
22 namespace OpenKalman::interface
23 {
31 #ifdef __cpp_concepts
32  template<typename T>
33 #else
34  template<typename T, typename>
35 #endif
37  {
38 #ifdef DOXYGEN_SHOULD_SKIP_THIS
39 
45  using scalar_type = double;
46 
47 
61 #ifdef __cpp_concepts
62  static constexpr values::index auto
63 #else
64  static constexpr auto
65 #endif
66  count_indices(const T& arg) = delete;
67 
68 
78 #ifdef __cpp_concepts
79  static constexpr coordinates::pattern auto
80  get_vector_space_descriptor(const T& arg, const values::index auto& n) = delete;
81 #else
82  template<typename N, std::enable_if_t<values::index<N>, int> = 0>
83  static constexpr auto
84  get_vector_space_descriptor(const T& arg, const N& n) = delete;
85 #endif
86 
87 
93 #ifdef __cpp_concepts
94  static indexible decltype(auto)
95  nested_object(std::convertible_to<const T&> auto&& arg) = delete;
96 #else
97  template<typename Arg, std::enable_if_t<std::is_convertible_v<Arg, const T&>, int> = 0>
98  static decltype(auto)
99  nested_object(Arg&& arg) = delete;
100 #endif
101 
102 
108 #ifdef __cpp_concepts
109  static constexpr values::scalar auto
110 #else
111  static constexpr auto
112 #endif
113  get_constant(const T& arg) = delete;
114 
115 
122 #ifdef __cpp_concepts
123  static constexpr values::scalar auto
124 #else
125  static constexpr auto
126 #endif
127  get_constant_diagonal(const T& arg) = delete;
128 
129 
136  template<Applicability b>
137  static constexpr bool
138  one_dimensional = false;
139 
140 
146  template<Applicability b>
147  static constexpr bool
148  is_square = false;
149 
150 
157  template<TriangleType t>
158  static constexpr bool
159  is_triangular = false;
160 
161 
166  static constexpr bool
167  is_triangular_adapter = false;
168 
169 
177  static constexpr bool
178  is_hermitian = false;
179 
180 
188  static constexpr HermitianAdapterType
189  hermitian_adapter_type = HermitianAdapterType::any;
190 
191 
195  static constexpr bool
196  is_writable = false;
197 
198 
203 #ifdef __cpp_lib_concepts
204  template<std::convertible_to<const T&> Arg> requires requires(Arg&& arg) { {*std::forward<Arg>(arg).data()} -> values::scalar; } and direct_access
205  static constexpr values::number decltype(auto)
206 #else
207  template<typename Arg, std::enable_if_t<
208  std::is_convertible_v<Arg, const T> and values::scalar<decltype(*std::declval<Arg&&>().data())> and direct_access, int> = 0>
209  static constexpr auto decltype(auto)
210 #endif
211  raw_data(Arg&& arg) = delete;
212 
213 
217  static constexpr Layout
218  layout = Layout::none;
219 
220 
231  static constexpr auto
232  strides(const T& arg) = delete;
233 
234 #endif // DOXYGEN_SHOULD_SKIP_THIS
235  };
236 
237 } // namespace OpenKalman::interface
238 
239 
240 #endif //OPENKALMAN_INDEXIBLE_OBJECT_TRAITS_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 bool one_dimensional
Specifies that a type is one-dimensional in every index.
Definition: one_dimensional.hpp:83
Definition: indexible_object_traits.hpp:36
Definition: basics.hpp:41
No storage layout (e.g., if the elements are calculated rather than stored).
Lower, upper, or diagonal matrix.
constexpr bool indexible
T is a generalized tensor type.
Definition: indexible.hpp:32
constexpr bool number
T is a numerical type.
Definition: number.hpp:33
HermitianAdapterType
The type of a hermitian adapter, indicating which triangle of the nested matrix is used...
Definition: global-definitions.hpp:78
Layout
The layout format of a multidimensional array.
Definition: global-definitions.hpp:47
constexpr bool index
T is an index value.
Definition: index.hpp:56
decltype(auto) constexpr nested_object(Arg &&arg)
Retrieve a nested object of Arg, if it exists.
Definition: nested_object.hpp:34
constexpr auto get_vector_space_descriptor(const T &t, const N &n)
Get the coordinates::pattern object for index N of indexible object T.
Definition: get_vector_space_descriptor.hpp:56