OpenKalman
TensorCwiseNullaryOp.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-2024 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_TENSORCWISENULLARYOP_HPP
17 #define OPENKALMAN_EIGEN_TRAITS_TENSORCWISENULLARYOP_HPP
18 
19 
20 namespace OpenKalman::interface
21 {
22  template<typename NullaryOp, typename XprType>
23  struct indexible_object_traits<Eigen::TensorCwiseNullaryOp<NullaryOp, XprType>>
24  : Eigen3::indexible_object_traits_tensor_base<Eigen::TensorCwiseNullaryOp<NullaryOp, XprType>>
25  {
26  private:
27 
29 
30  public:
31 
32  template<typename Arg, typename N>
33  static constexpr auto get_vector_space_descriptor(const Arg& arg, N n)
34  {
35  return OpenKalman::get_vector_space_descriptor(arg.nestedExpression(), n);
36  }
37 
38 #ifdef __cpp_concepts
39  template<typename Arg> requires has_dynamic_dimensions<XprType>
40 #else
41  template<typename X = XprType, typename Arg, std::enable_if_t<has_dynamic_dimensions<X>, int> = 0>
42 #endif
43  static decltype(auto) nested_object(Arg&& arg)
44  {
45  return std::forward<Arg>(arg).nestedExpression();
46  }
47 
48 
49  template<typename Arg>
50  static constexpr auto get_constant(const Arg& arg)
51  {
52  return Eigen3::NullaryFunctorTraits<NullaryOp, XprType>::template get_constant<false>(arg);
53  }
54 
55 
56  template<typename Arg>
57  static constexpr auto get_constant_diagonal(const Arg& arg)
58  {
60  }
61 
62 
63  template<Applicability b>
64  static constexpr bool one_dimensional = OpenKalman::one_dimensional<XprType, b>;
65 
66 
67  template<Applicability b>
68  static constexpr bool is_square = square_shaped<XprType, b>;
69 
70 
71  template<TriangleType t>
72  static constexpr bool is_triangular = Eigen3::NullaryFunctorTraits<NullaryOp, XprType>::template is_triangular<t>;
73 
74 
75  static constexpr bool is_triangular_adapter = false;
76 
77 
78  static constexpr bool is_hermitian = Eigen3::NullaryFunctorTraits<NullaryOp, XprType>::is_hermitian;
79 
80  };
81 
82 } // namespace OpenKalman::interface
83 
84 #endif //OPENKALMAN_EIGEN_TRAITS_TENSORCWISENULLARYOP_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
Definition: eigen-forward-declarations.hpp:32
Definition: eigen-comma-initializers.hpp:20
Trait object providing get and set routines for Eigen tensors.
Definition: eigen-tensor-forward-declarations.hpp:114
decltype(auto) constexpr nested_object(Arg &&arg)
Retrieve a nested object of Arg, if it exists.
Definition: nested_object.hpp:34
constexpr auto get_vector_space_descriptor(const T &t, const N &n)
Get the coordinates::pattern object for index N of indexible object T.
Definition: get_vector_space_descriptor.hpp:56