OpenKalman
Block.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_BLOCK_HPP
17 #define OPENKALMAN_EIGEN_TRAITS_BLOCK_HPP
18 
19 #include <type_traits>
20 
21 
22 namespace OpenKalman::interface
23 {
24  template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
25  struct object_traits<Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>>
26  : Eigen3::object_traits_base<Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>>
27  {
28  private:
29 
30  using Xpr = Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>;
32  using XprTypeNested = typename Eigen::internal::ref_selector<XprType>::non_const_type;
33 
34  public:
35 
36  template<typename Arg>
37  static decltype(auto) nested_object(Arg&& arg)
38  {
39  return std::forward<Arg>(arg).nestedExpression();
40  }
41 
42 
43  template<typename Arg>
44  static constexpr auto get_constant(const Arg& arg)
45  {
46  return constant_value {arg.nestedExpression()};
47  }
48 
49  };
50 
51 }
52 
53 #endif
Definition: basics.hpp:41
Definition: eigen-comma-initializers.hpp:20
Definition: object_traits.hpp:38
Trait object providing get and set routines.
Definition: eigen-forward-declarations.hpp:502
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