OpenKalman
CwiseTernaryOp.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) 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_CWISETERNARYOP_HPP
17 #define OPENKALMAN_EIGEN_TRAITS_CWISETERNARYOP_HPP
18 
19 #include <type_traits>
20 
21 
22 namespace OpenKalman::interface
23 {
24  template<typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
25  struct object_traits<Eigen::CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>>
26  : Eigen3::object_traits_base<Eigen::CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>>
27  {
28  private:
29 
30  using Xpr = Eigen::CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>;
32 
33  public:
34 
35  template<typename Arg, typename N>
36  static constexpr auto
37  get_pattern_collection(const Arg& arg, N n)
38  {
39  if constexpr (square_shaped<Arg1> or square_shaped<Arg2> or square_shaped<Arg3>)
40  return internal::most_fixed_pattern(
41  OpenKalman::get_pattern_collection<0>(arg.arg1()),
42  OpenKalman::get_pattern_collection<0>(arg.arg2()),
43  OpenKalman::get_pattern_collection<0>(arg.arg3()),
44  OpenKalman::get_pattern_collection<1>(arg.arg1()),
45  OpenKalman::get_pattern_collection<1>(arg.arg2()),
46  OpenKalman::get_pattern_collection<1>(arg.arg3()));
47  else
48  return internal::most_fixed_pattern(
51  OpenKalman::get_pattern_collection(arg.arg3(), n));
52  }
53 
54 
55  // nested_object not defined
56 
57 
58  template<typename Arg>
59  static constexpr auto get_constant(const Arg& arg)
60  {
62  return Traits::template get_constant<false>(arg);
63  }
64 
65  template<typename Arg>
66  static constexpr auto get_constant_diagonal(const Arg& arg)
67  {
69  return Traits::template get_constant<true>(arg);
70  }
71 
72  template<applicability b>
73  static constexpr bool one_dimensional =
74  OpenKalman::one_dimensional<Arg1, applicability::permitted> and
75  OpenKalman::one_dimensional<Arg2, applicability::permitted> and
76  OpenKalman::one_dimensional<Arg3, applicability::permitted> and
78  not has_dynamic_dimensions<Xpr> or
79  OpenKalman::one_dimensional<Arg1, b> or
80  OpenKalman::one_dimensional<Arg2, b> or
81  OpenKalman::one_dimensional<Arg3, b>);
82 
83 
84  template<applicability b>
85  static constexpr bool is_square =
86  square_shaped<Arg1, applicability::permitted> and
87  square_shaped<Arg2, applicability::permitted> and
88  square_shaped<Arg3, applicability::permitted> and
90  not has_dynamic_dimensions<Xpr> or
91  square_shaped<Arg1, b> or
92  square_shaped<Arg2, b> or
93  square_shaped<Arg3, b>);
94 
95 
96  template<triangle_type t>
97  static constexpr bool triangle_type_value = Eigen3::TernaryFunctorTraits<TernaryOp, Arg1, Arg2, Arg3>::template triangle_type_value<t>;
98 
99  static constexpr bool is_triangular_adapter = false;
100 
102  };
103 
104 }
105 
106 #endif
constexpr bool one_dimensional
Specifies that a type is one-dimensional in every index.
Definition: one_dimensional.hpp:56
Definition: basics.hpp:41
The concept, trait, or restraint represents a compile-time guarantee.
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
Definition: object_traits.hpp:38
Trait object providing get and set routines.
Definition: eigen-forward-declarations.hpp:502
Definition: eigen-forward-declarations.hpp:70