OpenKalman
conjugate.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) 2022-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_CONJUGATE_HPP
17 #define OPENKALMAN_CONJUGATE_HPP
18 
19 #include "values/values.hpp"
29 #include "make_constant.hpp"
30 //#include "to_diagonal.hpp"
31 
32 namespace OpenKalman
33 {
38 #ifdef __cpp_concepts
39  template<indexible Arg>
40 #else
41  template<typename Arg, std::enable_if_t<indexible<Arg>, int> = 0>
42 #endif
43  constexpr decltype(auto)
44  conjugate(Arg&& arg)
45  {
47  {
48  return std::forward<Arg>(arg);
49  }
50  else if constexpr (interface::conjugate_defined_for<Arg&&>)
51  {
53  }
54  else if constexpr (std::is_lvalue_reference_v<Arg>)
55  {
56  return conjugate(get_mdspan(arg));
57  }
58  else if constexpr (constant_object<Arg>)
59  {
60  return make_constant(values::conj(constant_value(arg)), get_pattern_collection(std::forward<Arg>(arg)));
61  }
62  else if constexpr (constant_diagonal_object<Arg>)
63  {
64  return to_diagonal(make_constant(values::conj(constant_value(arg)), get_pattern_collection(std::forward<Arg>(arg))));
65  }
66  else if constexpr (diagonal_matrix<Arg>)
67  {
68  //return to_diagonal(conjugate(diagonal_of(std::forward<Arg>(arg))));
69  }
70  else
71  {
72  static_assert(interface::conjugate_defined_for<Arg&&>, "Interface not defined");
73  }
74  }
75 
76 
77 }
78 
79 #endif
constexpr auto get_mdspan(T &t)
Get the coordinates::pattern_collection associated with indexible object T.
Definition: get_mdspan.hpp:35
Definition for constant_object.
Header file for code relating to values (e.g., scalars and indices)
decltype(auto) constexpr conjugate(Arg &&arg)
Take the complex conjugate of an indexible object.
Definition: conjugate.hpp:44
Definition for constant_diagonal_object.
constexpr bool complex
T is a value that reduces to std::complex or a custom complex type.
Definition: complex.hpp:47
decltype(auto) constexpr get_pattern_collection(T &&t)
Get the coordinates::pattern_collection associated with indexible object T.
Definition: get_pattern_collection.hpp:59
constexpr bool not_complex
T is a value in which either its type is not complex or its imaginary component is 0...
Definition: not_complex.hpp:48
decltype(auto) constexpr to_diagonal(Arg &&arg)
Convert an indexible object into a diagonal matrix.
Definition: to_diagonal.hpp:33
Definition for diagonal_matrix.
Definition for element_type_of.
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:42
constexpr auto conj(const Arg &arg)
A constexpr function for the complex conjugate of a (complex) number.
Definition: conj.hpp:39
Definition of get_mdspan function.
constexpr auto constant_value(T &&t)
The constant value associated with a constant_object or constant_diagonal_object. ...
Definition: constant_value.hpp:37
Definition for indexible.
constexpr auto make_constant(C c, stdex::extents< IndexType, Extents... > extents)
Make an indexible object in which every element is a constant value.
Definition: make_constant.hpp:39
The static constant value of an indexible object, if it exists.
Definition: constant_value_of.hpp:31
Definition for constant_value_of.
Definition for identity_matrix.
Definition for zero.
typename element_type_of< T >::type element_type_of_t
helper template for element_type_of.
Definition: element_type_of.hpp:54
Definitions for make_constant.