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 
20 namespace OpenKalman
21 {
22 #ifndef __cpp_concepts
23  namespace detail
24  {
25  template<typename T, typename = void>
26  struct is_inferred_hermitian_matrix : std::false_type {};
27 
28  template<typename T>
29  struct is_inferred_hermitian_matrix<T, std::enable_if_t<not values::complex<typename scalar_type_of<T>::type> or
30  values::not_complex<constant_coefficient<T>> or values::not_complex<constant_diagonal_coefficient<T>>>>
31  : std::true_type {};
32  };
33 #endif
34 
35 
42  template<typename T, Applicability b = Applicability::guaranteed>
43 #ifdef __cpp_concepts
44  concept hermitian_matrix = indexible<T> and square_shaped<T, b> and
45  (interface::indexible_object_traits<std::decay_t<T>>::is_hermitian or
46  ((constant_matrix<T> or diagonal_matrix<T>) and
49 #else
50  constexpr bool hermitian_matrix = square_shaped<T, b> and
52  ((constant_matrix<T> or diagonal_matrix<T>) and detail::is_inferred_hermitian_matrix<T>::value));
53 #endif
54 
55 
56 } // namespace OpenKalman
57 
58 #endif //OPENKALMAN_HERMITIAN_MATRIX_HPP
Definition: indexible_object_traits.hpp:36
typename scalar_type_of< T >::type scalar_type_of_t
helper template for scalar_type_of.
Definition: scalar_type_of.hpp:54
constexpr bool complex
T is a values::value that reduces to std::complex or a custom complex type.
Definition: complex.hpp:46
Definition: tuple_reverse.hpp:103
constexpr bool not_complex
T is a values::value in which either its type is not a values::complex or its imaginary component is ...
Definition: not_complex.hpp:47
Definition: object-traits-defined.hpp:311
The constant associated with T, assuming T is a constant_matrix.
Definition: constant_coefficient.hpp:36
The root namespace for OpenKalman.
Definition: basics.hpp:34
The constant associated with T, assuming T is a constant_diagonal_matrix.
Definition: constant_diagonal_coefficient.hpp:32
Definition: hermitian_matrix.hpp:26
constexpr bool hermitian_matrix
Specifies that a type is a hermitian matrix (assuming it is square_shaped).
Definition: hermitian_matrix.hpp:50