OpenKalman
hermitian_matrix.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) 2019-2023 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_HERMITIAN_MATRIX_HPP
17 #define OPENKALMAN_HERMITIAN_MATRIX_HPP
18 
19 #include "values/values.hpp"
24 
25 namespace OpenKalman
26 {
27 #ifndef __cpp_concepts
28  namespace detail
29  {
30  template<typename T, typename = void>
31  struct is_explicitly_hermitian : std::false_type {};
32 
33  template<typename T>
34  struct is_explicitly_hermitian<T, std::enable_if_t<interface::object_traits<stdex::remove_cvref_t<T>>::is_hermitian>>
35  : std::true_type {};
36 
37 
38  template<typename T, typename = void>
39  struct is_inferred_hermitian_matrix : std::false_type {};
40 
41  template<typename T>
42  struct is_inferred_hermitian_matrix<T, std::enable_if_t<values::not_complex<typename element_type_of<T>::type>>>
43  : std::true_type {};
44  };
45 #endif
46 
47 
52  template<typename T>
53 #ifdef __cpp_concepts
54  concept hermitian_matrix =
55  square_shaped<T> and
56  (interface::object_traits<stdex::remove_cvref_t<T>>::is_hermitian or
57  ((constant_object<T> or diagonal_matrix<T>) and values::not_complex<element_type_of_t<T>>));
58 #else
59  constexpr bool hermitian_matrix =
60  square_shaped<T> and
62  ((constant_object<T> or diagonal_matrix<T>) and detail::is_inferred_hermitian_matrix<T>::value));
63 #endif
64 
65 
66 }
67 
68 #endif
Definition for constant_object.
Header file for code relating to values (e.g., scalars and indices)
Definition for square_shaped.
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
Definition for diagonal_matrix.
constexpr bool hermitian_matrix
Specifies that a type is a hermitian matrix.
Definition: hermitian_matrix.hpp:59
Definition for element_type_of.
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition: object_traits.hpp:38
Definition: hermitian_matrix.hpp:39
Definition: hermitian_matrix.hpp:31
typename element_type_of< T >::type element_type_of_t
helper template for element_type_of.
Definition: element_type_of.hpp:54