16 #ifndef OPENKALMAN_EIGEN_TRAITS_SELECT_HPP 17 #define OPENKALMAN_EIGEN_TRAITS_SELECT_HPP 19 #include <type_traits> 24 template<
typename ConditionMatrixType,
typename ThenMatrixType,
typename ElseMatrixType>
30 using Xpr = Eigen::Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType>;
35 template<
typename Arg,
typename N>
38 if constexpr (square_shaped<ConditionMatrixType> or square_shaped<ThenMatrixType> or square_shaped<ElseMatrixType>)
39 return internal::best_vector_space_descriptor(
40 OpenKalman::get_vector_space_descriptor<0>(arg.conditionMatrix()),
41 OpenKalman::get_vector_space_descriptor<0>(arg.thenMatrix()),
42 OpenKalman::get_vector_space_descriptor<0>(arg.elseMatrix()),
43 OpenKalman::get_vector_space_descriptor<1>(arg.conditionMatrix()),
44 OpenKalman::get_vector_space_descriptor<1>(arg.thenMatrix()),
45 OpenKalman::get_vector_space_descriptor<1>(arg.elseMatrix()));
47 return internal::best_vector_space_descriptor(
57 template<
typename Arg>
58 static constexpr
auto get_constant(
const Arg& arg)
60 if constexpr (constant_matrix<ConditionMatrixType>)
62 if constexpr (static_cast<bool>(constant_coefficient_v<ConditionMatrixType>))
67 else if constexpr (constant_matrix<ThenMatrixType> and constant_matrix<ElseMatrixType>)
69 if constexpr (constant_coefficient_v<ThenMatrixType> == constant_coefficient_v<ElseMatrixType>)
71 else return std::monostate{};
73 else return std::monostate{};
77 template<
typename Arg>
78 static constexpr
auto get_constant_diagonal(
const Arg& arg)
80 if constexpr (constant_matrix<ConditionMatrixType>)
82 if constexpr (static_cast<bool>(constant_coefficient_v<ConditionMatrixType>))
87 else if constexpr (constant_diagonal_matrix<ThenMatrixType> and constant_diagonal_matrix<ElseMatrixType>)
89 if constexpr (constant_diagonal_coefficient_v<ThenMatrixType> == constant_diagonal_coefficient_v<ElseMatrixType>)
91 else return std::monostate{};
93 else return std::monostate{};
97 template<Applicability b>
99 OpenKalman::one_dimensional<ConditionMatrixType, Applicability::permitted> and
100 OpenKalman::one_dimensional<ThenMatrixType, Applicability::permitted> and
101 OpenKalman::one_dimensional<ElseMatrixType, Applicability::permitted> and
103 not has_dynamic_dimensions<Xpr> or
104 OpenKalman::one_dimensional<ConditionMatrixType> or
105 OpenKalman::one_dimensional<ThenMatrixType> or
106 OpenKalman::one_dimensional<ElseMatrixType>);
109 template<Applicability b>
110 static constexpr
bool is_square =
111 square_shaped<ConditionMatrixType, Applicability::permitted> and
112 square_shaped<ThenMatrixType, Applicability::permitted> and
113 square_shaped<ElseMatrixType, Applicability::permitted> and
115 not has_dynamic_dimensions<Xpr> or
116 square_shaped<ConditionMatrixType, b> or
117 square_shaped<ThenMatrixType, b> or
118 square_shaped<ElseMatrixType, b>);
121 template<TriangleType t>
122 static constexpr
bool is_triangular =
124 if constexpr (constant_matrix<ConditionMatrixType>)
125 return triangular_matrix<std::conditional_t<static_cast<bool>(constant_coefficient_v<ConditionMatrixType>),
126 ThenMatrixType, ElseMatrixType>, t>;
131 static constexpr
bool is_triangular_adapter =
false;
134 static constexpr
bool is_hermitian =
135 (values::fixed<constant_coefficient<ConditionMatrixType>> and
137 if constexpr (constant_matrix<ConditionMatrixType>)
138 return hermitian_matrix<std::conditional_t<static_cast<bool>(constant_coefficient_v<ConditionMatrixType>),
142 (hermitian_matrix<ConditionMatrixType, Applicability::permitted> and hermitian_matrix<ThenMatrixType, Applicability::permitted> and
143 hermitian_matrix<ElseMatrixType, Applicability::permitted> and
150 #endif //OPENKALMAN_EIGEN_TRAITS_SELECT_HPP 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
The concept, trait, or restraint is permitted, but whether it applies is not necessarily known at com...
The constant associated with T, assuming T is a constant_diagonal_matrix.
Definition: constant_diagonal_coefficient.hpp:32
constexpr bool fixed
T is a values::value that is determinable at compile time.
Definition: fixed.hpp:60
The concept, trait, or restraint represents a compile-time guarantee.
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