OpenKalman
real.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_VALUE_REAL_HPP
17 #define OPENKALMAN_VALUE_REAL_HPP
18 
22 
23 namespace OpenKalman::values
24 {
33 #ifdef __cpp_concepts
34  template<value Arg>
35  constexpr value auto
36 #else
37  template<typename Arg, std::enable_if_t<value<Arg>, int> = 0>
38  constexpr auto
39 #endif
40  real(Arg arg)
41  {
42  if constexpr (fixed<Arg>)
43  return operation {
44  [](auto a) { return interface::number_traits<std::decay_t<decltype(a)>>::real(std::move(a)); },
45  std::move(arg)};
46  else
48  }
49 
50 
51 } // namespace OpenKalman::values
52 
53 
54 #endif //OPENKALMAN_VALUE_REAL_HPP
An operation involving some number of values.
Definition: operation.hpp:69
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
constexpr auto real(Arg arg)
A constexpr function to obtain the real part of a (complex) number.
Definition: real.hpp:40
Definition for values::abs.
Definition: constant_coefficient.hpp:25
Definition for ::fixed.
Definition: number_traits.hpp:36
Definition for ::value.