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