16 #ifndef OPENKALMAN_EIGEN_PARTIALREDUXEXPR_HPP 17 #define OPENKALMAN_EIGEN_PARTIALREDUXEXPR_HPP 19 #include <type_traits> 24 template<
typename Dim,
typename OtherDim>
27 template<
typename Dim,
typename OtherDim,
typename =
void>
30 template<
typename Dim,
typename OtherDim>
32 values::fixed<Dim> and values::fixed<OtherDim>>>
33 : std::bool_constant<std::decay_t<Dim>::value >= std::decay_t<OtherDim>
::value> {};
35 template<
typename Dim,
typename OtherDim>
40 template<
typename MemberOp, std::
size_t direction,
typename XprType,
typename Factor,
typename DirDim,
typename Func>
41 constexpr
auto get_constant_redux(
const XprType& xpr,
const Factor& factor,
const DirDim& dir_dim, Func&& func)
43 auto dim = internal::best_vector_space_descriptor(dir_dim, get_index_dimension_of<direction>(xpr));
45 if constexpr (Eigen3::eigen_MatrixWrapper<XprType> or Eigen3::eigen_ArrayWrapper<XprType> or
46 internal::fixed_size_adapter<XprType> or Eigen3::eigen_wrapper<XprType>)
48 return get_constant_redux<MemberOp, direction>(
nested_object(xpr), factor, dim, std::forward<Func>(func));
50 else if constexpr (Eigen3::eigen_CwiseUnaryOp<XprType> or Eigen3::eigen_CwiseUnaryView<XprType>)
53 return get_constant_redux<MemberOp, direction>(xpr.nestedExpression(), factor, dim, std::move(new_func));
55 else if constexpr (Eigen3::eigen_Replicate<XprType>)
58 const auto& n_xpr = xpr.nestedExpression();
59 auto n_dim = get_index_dimension_of<direction>(n_xpr);
61 auto f = [](
const auto& dim,
const auto& n_dim) {
66 auto new_dim = [](
const auto& dim,
const auto& n_dim) {
75 return get_constant_redux<MemberOp, direction>(n_xpr, new_f, new_dim, std::forward<Func>(func));
79 if constexpr (constant_matrix<XprType>)
84 else if constexpr (constant_diagonal_matrix<XprType>)
86 constexpr
bool als = at_least_square<decltype(dim), decltype(get_index_dimension_of<direction == 1 ? 0 : 1>(xpr))>;
92 return std::monostate {};
107 template<
typename MatrixType,
typename MemberOp,
int Direction>
115 #if __cplusplus < 202002L 118 template<
typename Scalar>
119 constexpr Scalar&& operator()(Scalar&& arg)
const {
return std::forward<Scalar>(arg); }
125 template<
typename Arg>
128 return std::forward<Arg>(arg).nestedExpression();
135 template<
typename Arg>
136 static constexpr
auto get_constant(
const Arg& arg)
139 constexpr std::size_t direction = Direction == Eigen::Horizontal ? 1 : 0;
140 const auto& x = arg.nestedExpression();
141 auto dim = get_index_dimension_of<direction>(x);
142 std::integral_constant<std::size_t, 1> f;
143 #if __cplusplus >= 202002L 144 return OpenKalman::Eigen3::detail::get_constant_redux<MemberOp, direction>(x, f, dim, std::identity{});
146 return OpenKalman::Eigen3::detail::get_constant_redux<MemberOp, direction>(x, f, dim, Op{});
154 #endif //OPENKALMAN_EIGEN_PARTIALREDUXEXPR_HPP Definition: indexible_object_traits.hpp:36
Definition: basics.hpp:41
An operation involving some number of values.
Definition: operation.hpp:69
Trait object providing get and set routines.
Definition: eigen-forward-declarations.hpp:502
Definition: eigen-comma-initializers.hpp:20
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
Definition: eigen-forward-declarations.hpp:97
The constant associated with T, assuming T is a constant_matrix.
Definition: constant_coefficient.hpp:36
The constant associated with T, assuming T is a constant_diagonal_matrix.
Definition: constant_diagonal_coefficient.hpp:32
Definition: PartialReduxExpr.hpp:28
The replication factor for Eigen::Replicate in a given direction.
Definition: eigen-forward-declarations.hpp:310
constexpr bool fixed
T is a values::value that is determinable at compile time.
Definition: fixed.hpp:60
Compose two Eigen functors F1 and F2.
Definition: functor_composition.hpp:29
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33
decltype(auto) constexpr nested_object(Arg &&arg)
Retrieve a nested object of Arg, if it exists.
Definition: nested_object.hpp:34