OpenKalman
Reverse.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_REVERSE_HPP
17 #define OPENKALMAN_EIGEN_TRAITS_REVERSE_HPP
18 
19 #include <type_traits>
20 
21 
22 namespace OpenKalman::interface
23 {
24  template<typename MatrixType, int Direction>
25  struct object_traits<Eigen::Reverse<MatrixType, Direction>>
26  : Eigen3::object_traits_base<Eigen::Reverse<MatrixType, Direction>>
27  {
28  private:
29 
31 
32  public:
33 
34  template<typename Arg, typename N>
35  static constexpr auto get_pattern_collection(const Arg& arg, N n)
36  {
37  return OpenKalman::get_pattern_collection(arg.nestedExpression(), n);
38  }
39 
40 
41  template<typename Arg>
42  static decltype(auto) nested_object(Arg&& arg)
43  {
44  return std::forward<Arg>(arg).nestedExpression();
45  }
46 
47 
48  template<typename Arg>
49  static constexpr auto get_constant(const Arg& arg)
50  {
51  return constant_value {arg.nestedExpression()};
52  }
53 
54 
55  template<typename Arg>
56  static constexpr auto get_constant_diagonal(const Arg& arg)
57  {
58  if constexpr (Direction == Eigen::BothDirections) return constant_diagonal_value {arg.nestedExpression()};
59  else return std::monostate {};
60  }
61 
62 
63  template<applicability b>
64  static constexpr bool one_dimensional = OpenKalman::one_dimensional<MatrixType, b>;
65 
66 
67  template<applicability b>
68  static constexpr bool is_square = square_shaped<MatrixType, b>;
69 
70 
71  template<triangle_type t>
72  static constexpr bool triangle_type_value = triangular_matrix<MatrixType,
75  (Direction == Eigen::BothDirections or (Direction == Eigen::Horizontal and vector<MatrixType, 0>) or
76  (Direction == Eigen::Vertical and vector<MatrixType, 1>));
77 
78 
79  static constexpr bool is_triangular_adapter = false;
80 
81 
82  static constexpr bool is_hermitian = hermitian_matrix<MatrixType, applicability::permitted> and
83  (Direction == Eigen::BothDirections or vector<MatrixType, 0> or vector<MatrixType, 1>);
84  };
85 
86 
87 }
88 
89 #endif
constexpr bool one_dimensional
Specifies that a type is one-dimensional in every index.
Definition: one_dimensional.hpp:56
Definition: basics.hpp:41
A lower-left triangular matrix.
Definition: eigen-comma-initializers.hpp:20
decltype(auto) constexpr get_pattern_collection(T &&t)
Get the coordinates::pattern_collection associated with indexible object T.
Definition: get_pattern_collection.hpp:59
constexpr bool triangular_matrix
Specifies that an argument is an indexible object having a given triangle_type (e.g., upper, lower, or diagonal).
Definition: triangular_matrix.hpp:36
Definition: object_traits.hpp:38
Trait object providing get and set routines.
Definition: eigen-forward-declarations.hpp:502
An upper-right triangular matrix.
constexpr auto constant_value(T &&t)
The constant value associated with a constant_object or constant_diagonal_object. ...
Definition: constant_value.hpp:37
decltype(auto) constexpr nested_object(Arg &&arg)
Retrieve a nested object of Arg, if it exists.
Definition: nested_object.hpp:35