16 #ifndef OPENKALMAN_EIGEN_TRAITS_CWISEUNARYVIEW_HPP 17 #define OPENKALMAN_EIGEN_TRAITS_CWISEUNARYVIEW_HPP 19 #include <type_traits> 24 template<
typename ViewOp,
typename MatrixType>
30 using Xpr = Eigen::CwiseUnaryView<ViewOp, MatrixType>;
36 template<
typename Arg,
typename N>
43 template<
typename Arg>
46 return std::forward<Arg>(arg).nestedExpression();
51 #ifndef __cpp_concepts 52 template<
typename T,
typename =
void>
53 struct custom_get_constant_defined : std::false_type {};
56 struct custom_get_constant_defined<T, std::void_t<decltype(T::template get_constant(std::declval<const Xpr&>()))>>
63 get_constant(
const Xpr& arg)
66 if constexpr (requires { Traits::get_constant(arg); })
70 return Traits::template get_constant(arg);
72 else if constexpr (Eigen3::constexpr_unary_operation_defined<ViewOp>)
75 else if constexpr (Eigen3::constexpr_unary_operation_defined<ViewOp> and
values::fixed<constant_value<MatrixType>>)
76 return values::operation(Traits::constexpr_operation(), constant_value<MatrixType>{});
84 #ifndef __cpp_concepts 85 template<
typename T,
typename =
void>
86 struct custom_get_constant_diagonal_defined : std::false_type {};
89 struct custom_get_constant_diagonal_defined<T, std::void_t<decltype(T::template get_constant_diagonal<MatrixType>(std::declval<const Xpr&>()))>>
96 get_constant_diagonal(
const Xpr& arg)
99 if constexpr (requires { Traits::get_constant_diagonal(arg); })
103 return Traits::template get_constant_diagonal<MatrixType>(arg);
104 else if constexpr (not Traits::preserves_triangle)
105 return std::monostate{};
106 else if constexpr (Eigen3::constexpr_unary_operation_defined<ViewOp>)
107 return values::operation(Traits::constexpr_operation(), constant_diagonal_value{arg.nestedExpression()});
109 return values::operation(arg.functor(), constant_diagonal_value{arg.nestedExpression()});
113 template<applicability b>
114 static constexpr
bool one_dimensional = OpenKalman::one_dimensional<MatrixType, b>;
117 template<applicability b>
118 static constexpr
bool is_square = square_shaped<MatrixType, b>;
121 static constexpr
bool is_triangular_adapter =
false;
124 template<triangle_type t>
125 static constexpr
bool triangle_type_value = Traits::preserves_triangle and triangular_matrix<MatrixType, t>;
128 static constexpr
bool is_hermitian = Traits ::preserves_hermitian and hermitian_matrix<MatrixType, applicability::permitted>;
constexpr bool one_dimensional
Specifies that a type is one-dimensional in every index.
Definition: one_dimensional.hpp:56
Definition: basics.hpp:41
Definition: eigen-forward-declarations.hpp:41
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
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
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
constexpr bool fixed
T is a value that is determinable at compile time.
Definition: fixed.hpp:66
decltype(auto) constexpr nested_object(Arg &&arg)
Retrieve a nested object of Arg, if it exists.
Definition: nested_object.hpp:35
constexpr auto operation(Operation &&op, Args &&...args)
A potentially constant-evaluated operation involving some number of values.
Definition: operation.hpp:98