OpenKalman
conjugate_transpose.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-2026 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_TRANSPOSE_HPP
17 #define OPENKALMAN_CONJUGATE_TRANSPOSE_HPP
18 
19 #include "patterns/patterns.hpp"
20 #include "conjugate.hpp"
21 #include "transpose.hpp"
22 
23 namespace OpenKalman
24 {
28 #ifdef __cpp_concepts
29  template<indexible Arg>
30  constexpr indexible decltype(auto)
31 #else
32  template<typename Arg, std::enable_if_t<indexible<Arg>, int> = 0>
33  constexpr decltype(auto)
34 #endif
36  {
37  using P = decltype(get_pattern_collection(arg));
38  constexpr bool square = patterns::compares_with<patterns::pattern_collection_element_t<0, P>, patterns::pattern_collection_element_t<1, P>>;
39  if constexpr (hermitian_matrix<Arg> and square)
40  {
41  return std::forward<Arg>(arg);
42  }
43  else if constexpr ((diagonal_matrix<Arg> or constant_object<Arg>) and square)
44  {
45  return conjugate(std::forward<Arg>(arg));
46  }
48  {
49  return transpose(std::forward<Arg>(arg));
50  }
51  else if constexpr (interface::conjugate_transpose_defined_for<Arg&&>)
52  {
54  }
55  else
56  {
57  return conjugate(transpose(std::forward<Arg>(arg)));
58  }
59  }
60 
61 }
62 
63 #endif
decltype(auto) constexpr conjugate(Arg &&arg)
Take the complex conjugate of an indexible object.
Definition: conjugate.hpp:44
constexpr bool complex
T is a value that reduces to std::complex or a custom complex type.
Definition: complex.hpp:47
constexpr bool indexible
T is a multidimensional array type.
Definition: indexible.hpp:32
decltype(auto) constexpr get_pattern_collection(T &&t)
Get the patterns::pattern_collection associated with indexible object T.
Definition: get_pattern_collection.hpp:36
decltype(auto) constexpr conjugate_transpose(Arg &&arg)
Take the conjugate-transpose of an indexible_object.
Definition: conjugate_transpose.hpp:35
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
typename pattern_collection_element< i, T >::type pattern_collection_element_t
Helper template for collection_element.
Definition: pattern_collection_element.hpp:58
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
decltype(auto) constexpr transpose(Arg &&arg)
Swap any two indices of an indexible_object.
Definition: transpose.hpp:49
Definition of transpose function.
The static constant value of an indexible object, if it exists.
Definition: constant_value_of.hpp:31
Definition of conjugate function.
typename element_type_of< T >::type element_type_of_t
helper template for element_type_of.
Definition: element_type_of.hpp:54