OpenKalman
vector.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-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 
16 #ifndef OPENKALMAN_VECTOR_HPP
17 #define OPENKALMAN_VECTOR_HPP
18 
21 
22 namespace OpenKalman
23 {
24  namespace detail
25  {
26  template<typename T, std::size_t N, applicability b, std::size_t...is>
27  constexpr auto
28  vector_fixed_index_count(std::index_sequence<is...>)
29  {
30  return (... and (N == is or dimension_size_of_index_is<T, is, 1, &stdex::is_eq, b>));
31  }
32 
33 
34  template<typename T, std::size_t N, applicability b>
35  constexpr auto
36  vector_impl()
37  {
38  if constexpr (not indexible<T>) // Only needed for c++17 mode
39  return false;
40  else
41  return detail::vector_fixed_index_count<T, N, b>(std::make_index_sequence<index_count_v<T>>{});
42  }
43 
44  }
45 
46 
56  template<typename T, std::size_t N = 0, applicability b = applicability::guaranteed>
57 #ifdef __cpp_concepts
58  concept vector =
59 #else
60  constexpr bool vector =
61 #endif
62  indexible<T> and
63  detail::vector_impl<T, N, b>();
64 
65 
66 }
67 
68 #endif
applicability
The applicability of a concept, trait, or restraint.
Definition: constants.hpp:35
Definition for dimension_size_of_index_is.
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition for index_count.
Definition: trait_backports.hpp:64
constexpr bool vector
T is a vector (e.g., column or row vector).
Definition: vector.hpp:60