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;
84 static constexpr
bool is_triangular_adapter =
false;
constexpr bool one_dimensional
Specifies that a type is one-dimensional in every index.
Definition: one_dimensional.hpp:56
Definition: basics.hpp:41
triangle_type
The type of a triangular matrix.
Definition: enumerations.hpp:26
constexpr auto count_indices(const T &)
Get the number of indices necessary to address all the components of an indexible object...
Definition: count_indices.hpp:51
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
A diagonal matrix (both a lower-left and an upper-right triangular matrix).
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