OpenKalman
get_singular_component.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) 2023-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_GET_SINGULAR_COMPONENT_HPP
17 #define OPENKALMAN_GET_SINGULAR_COMPONENT_HPP
18 
22 
23 namespace OpenKalman::internal
24 {
29  template<typename Arg>
30  constexpr decltype(auto)
31  get_singular_component(Arg&& arg)
32  {
33  auto mds = get_mdspan(std::forward<Arg>(arg));
34  constexpr std::size_t rank = std::decay_t<decltype(mds)>::rank();
35  return mds[std::array<std::integral_constant<std::size_t, 0>, rank>{}];
36  }
37 
38 
39 }
40 
41 #endif
constexpr auto get_mdspan(T &t)
Get the coordinates::pattern_collection associated with indexible object T.
Definition: get_mdspan.hpp:35
Definition of count_indices.
Definition for access function.
Definition for index_count.
Definition: basics.hpp:48