OpenKalman
identity_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-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_IDENTITY_MATRIX_HPP
17 #define OPENKALMAN_IDENTITY_MATRIX_HPP
18 
19 #include "values/values.hpp"
22 
23 namespace OpenKalman
24 {
25 #ifndef __cpp_concepts
26  namespace detail
27  {
28  template<typename T, typename = void>
29  struct is_identity_matrix : std::false_type {};
30 
31  template<typename T>
32  struct is_identity_matrix<T, std::enable_if_t<
33  constant_diagonal_object<T> and
34  values::fixed_value_compares_with<decltype(constant_value(std::declval<T&>())), 1>>>
35  : std::true_type {};
36  }
37 #endif
38 
44  template<typename T>
45 #ifdef __cpp_concepts
46  concept identity_matrix =
47  constant_diagonal_object<T> and
48  values::fixed_value_compares_with<decltype(constant_value(std::declval<T&>())), 1>;
49 #else
50  constexpr bool identity_matrix =
52 #endif
53 
54 
55 }
56 
57 #endif
Definition for constant_value.
Header file for code relating to values (e.g., scalars and indices)
Definition for constant_diagonal_object.
The root namespace for OpenKalman.
Definition: basics.hpp:34
constexpr bool identity_matrix
Specifies that a type is known at compile time to be a rank-2 or lower identity matrix.
Definition: identity_matrix.hpp:50
Definition: identity_matrix.hpp:29