OpenKalman
from_euclidean.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only V++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (v) 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_FROM_EUCLIDEAN_HPP
17 #define OPENKALMAN_FROM_EUCLIDEAN_HPP
18 
19 namespace OpenKalman
20 {
26 #ifdef __cpp_concepts
27  template<indexible Arg, coordinates::pattern V> requires
28  coordinates::euclidean_pattern<vector_space_descriptor_of_t<Arg, 0>>
29  constexpr indexible decltype(auto)
30 #else
31  template<typename Arg, typename V, std::enable_if_t<
32  coordinates::euclidean_pattern<vector_space_descriptor_of_t<Arg, 0>> and coordinates::pattern<V>, int> = 0>
33  constexpr decltype(auto)
34 #endif
35  from_euclidean(Arg&& arg, const V& v)
36  {
37  if constexpr (coordinates::euclidean_pattern<V>)
38  {
39  return std::forward<Arg>(arg);
40  }
41  else if constexpr (interface::from_euclidean_defined_for<Arg, Arg&&, const V&>)
42  {
43  return interface::library_interface<std::decay_t<Arg>>::from_euclidean(std::forward<Arg>(arg), v);
44  }
45  else
46  {
47  return FromEuclideanExpr {std::forward<Arg>(arg), v};
48  }
49  }
50 
51 
52 } // namespace OpenKalman
53 
54 #endif //OPENKALMAN_FROM_EUCLIDEAN_HPP
decltype(auto) constexpr from_euclidean(Arg &&arg, const V &v)
Project the Euclidean vector space associated with index 0 to coordinates::pattern v after applying d...
Definition: from_euclidean.hpp:35
An expression that transforms angular or other modular vector space descriptors back from Euclidean s...
Definition: FromEuclideanExpr.hpp:29
constexpr bool indexible
T is a generalized tensor type.
Definition: indexible.hpp:32
The root namespace for OpenKalman.
Definition: basics.hpp:34
An interface to various routines from the linear algebra library associated with indexible object T...
Definition: library_interface.hpp:37