16 #ifndef OPENKALMAN_EIGEN_TRAITS_CWISEUNARYOP_HPP 17 #define OPENKALMAN_EIGEN_TRAITS_CWISEUNARYOP_HPP 22 template<
typename UnaryOp,
typename XprType>
28 using Xpr = Eigen::CwiseUnaryOp<UnaryOp, XprType>;
33 struct is_bind_operator : std::false_type {};
35 template<
typename BinaryOp>
36 struct is_bind_operator<Eigen::internal::bind1st_op<BinaryOp>> : std::true_type {};
38 template<
typename BinaryOp>
39 struct is_bind_operator<Eigen::internal::bind2nd_op<BinaryOp>> : std::true_type {};
43 template<
typename Arg,
typename N>
51 template<
typename Arg>
55 return std::as_const(arg).nestedExpression();
60 #ifndef __cpp_concepts 61 template<
typename T,
typename =
void>
62 struct custom_get_constant_defined : std::false_type {};
65 struct custom_get_constant_defined<T, std::void_t<decltype(T::get_constant(std::declval<const Xpr&>()))>>
72 get_constant(
const Xpr& arg)
75 if constexpr (requires { Traits::get_constant(arg); })
79 return Traits::get_constant(arg);
80 else if constexpr (Eigen3::constexpr_unary_operation_defined<UnaryOp>)
88 #ifndef __cpp_concepts 89 template<
typename T,
typename =
void>
90 struct custom_get_constant_diagonal_defined : std::false_type {};
93 struct custom_get_constant_diagonal_defined<T, std::void_t<decltype(T::get_constant_diagonal(std::declval<const Xpr&>()))>>
100 get_constant_diagonal(
const Xpr& arg)
102 #ifdef __cpp_concepts 103 if constexpr (requires { Traits::get_constant_diagonal(arg); })
107 return Traits::get_constant_diagonal(arg);
108 else if constexpr (not Traits::preserves_triangle)
109 return std::monostate{};
110 else if constexpr (Eigen3::constexpr_unary_operation_defined<UnaryOp>)
111 return values::operation(Traits::constexpr_operation(), constant_diagonal_value{arg.nestedExpression()});
113 return values::operation(arg.functor(), constant_diagonal_value{arg.nestedExpression()});
117 template<applicability b>
118 static constexpr
bool one_dimensional = OpenKalman::one_dimensional<XprType, b>;
121 template<applicability b>
122 static constexpr
bool is_square = square_shaped<XprType, b>;
125 static constexpr
bool is_triangular_adapter =
false;
128 template<triangle_type t>
129 static constexpr
bool triangle_type_value = Traits::preserves_triangle and triangular_matrix<XprType, t>;
132 static constexpr
bool is_hermitian = Traits::preserves_hermitian and hermitian_matrix<XprType, 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
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