16 #ifndef OPENKALMAN_EIGEN_TRAITS_DIAGONALWRAPPER_HPP 17 #define OPENKALMAN_EIGEN_TRAITS_DIAGONALWRAPPER_HPP 19 #include <type_traits> 24 template<
typename DiagVectorType>
30 using Xpr = Eigen::DiagonalWrapper<DiagVectorType>;
35 template<
typename Arg>
39 if constexpr (Arg::RowsAtCompileTime == 1 and Arg::ColsAtCompileTime == 1)
40 return std::integral_constant<std::size_t, 0_uz>{};
42 return std::integral_constant<std::size_t, 2_uz>{};
46 template<
typename Arg,
typename N>
49 if constexpr (has_dynamic_dimensions<DiagVectorType>)
return static_cast<std::size_t
>(arg.rows());
50 else return Dimensions<index_dimension_of_v<DiagVectorType, 0> * index_dimension_of_v<DiagVectorType, 1>>{};
54 template<
typename Arg>
57 auto&& d = std::forward<Arg>(arg).
diagonal();
58 using D = decltype(d);
59 using NCD = std::conditional_t<
60 std::is_const_v<std::remove_reference_t<Arg>> or std::is_const_v<DiagVectorType>,
61 D, std::conditional_t<std::is_lvalue_reference_v<D>, std::decay_t<D>&, std::decay_t<D>>>;
62 return const_cast<NCD
>(std::forward<decltype(d)>(d));
66 template<
typename Arg>
67 static constexpr
auto get_constant_diagonal(
const Arg& arg)
73 template<Applicability b>
74 static constexpr
bool one_dimensional = OpenKalman::one_dimensional<DiagVectorType, b>;
77 template<Applicability b>
78 static constexpr
bool is_square =
true;
81 template<TriangleType t>
82 static constexpr
bool is_triangular =
true;
85 static constexpr
bool is_triangular_adapter =
false;
95 #endif //OPENKALMAN_EIGEN_TRAITS_DIAGONALWRAPPER_HPP constexpr auto count_indices(const T &t)
Get the number of indices available to address the components of an indexible object.
Definition: count_indices.hpp:33
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
The constant associated with T, assuming T is a constant_matrix.
Definition: constant_coefficient.hpp:36
A diagonal matrix (both a lower-left and an upper-right triangular matrix).
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