OpenKalman
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) 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_EIGEN_TRAITS_TRANSPOSE_HPP
17 #define OPENKALMAN_EIGEN_TRAITS_TRANSPOSE_HPP
18 
19 #include <type_traits>
20 
21 
22 namespace OpenKalman::interface
23 {
24  template<typename MatrixType>
25  struct indexible_object_traits<Eigen::Transpose<MatrixType>>
26  : Eigen3::indexible_object_traits_base<Eigen::Transpose<MatrixType>>
27  {
28  private:
29 
30  using Xpr = Eigen::Transpose<MatrixType>;
32 
33  public:
34 
35  template<typename Arg>
36  static decltype(auto) nested_object(Arg&& arg)
37  {
38  return std::forward<Arg>(arg).nestedExpression();
39  }
40 
41 
42  template<typename Arg>
43  static constexpr auto get_constant(const Arg& arg)
44  {
45  return constant_coefficient{arg.nestedExpression()};
46  }
47 
48 
49  template<typename Arg>
50  static constexpr auto get_constant_diagonal(const Arg& arg)
51  {
52  return constant_diagonal_coefficient {arg.nestedExpression()};
53  }
54 
55 
56  template<Applicability b>
57  static constexpr bool one_dimensional = OpenKalman::one_dimensional<MatrixType, b>;
58 
59 
60  template<Applicability b>
61  static constexpr bool is_square = square_shaped<MatrixType, b>;
62 
63 
64  template<TriangleType t>
65  static constexpr bool is_triangular = diagonal_matrix<MatrixType> or
66  (t == TriangleType::lower and triangular_matrix<MatrixType, TriangleType::upper>) or
67  (t == TriangleType::upper and triangular_matrix<MatrixType, TriangleType::lower>);
68 
69 
70  static constexpr bool is_triangular_adapter = false;
71 
72 
73  static constexpr bool is_hermitian = hermitian_matrix<MatrixType, Applicability::permitted>;
74 
75 
76  static constexpr Layout layout = layout_of_v<MatrixType>;
77 
78  };
79 
80 
81 } // namespace OpenKalman::interface
82 
83 #endif //OPENKALMAN_EIGEN_TRAITS_TRANSPOSE_HPP
constexpr bool one_dimensional
Specifies that a type is one-dimensional in every index.
Definition: one_dimensional.hpp:83
Definition: indexible_object_traits.hpp:36
Definition: basics.hpp:41
Trait object providing get and set routines.
Definition: eigen-forward-declarations.hpp:502
Definition: eigen-comma-initializers.hpp:20
An upper-right triangular matrix.
The constant associated with T, assuming T is a constant_matrix.
Definition: constant_coefficient.hpp:36
The constant associated with T, assuming T is a constant_diagonal_matrix.
Definition: constant_diagonal_coefficient.hpp:32
Layout
The layout format of a multidimensional array.
Definition: global-definitions.hpp:47
decltype(auto) constexpr nested_object(Arg &&arg)
Retrieve a nested object of Arg, if it exists.
Definition: nested_object.hpp:34
A lower-left triangular matrix.