@@ -50,6 +50,11 @@ concept arithmetic = std::integral<Type> || std::floating_point<Type>;
50
50
template <typename Type>
51
51
concept algebraic = not arithmetic<Type>;
52
52
53
+ template <typename Type>
54
+ concept eigen = requires {
55
+ typename Type::PlainMatrix;
56
+ };
57
+
53
58
struct empty {
54
59
inline constexpr explicit empty ([[maybe_unused]] auto &&...any) noexcept {
55
60
// Constructs from anything for all initializations compatibility.
@@ -122,36 +127,30 @@ struct transpose final {
122
127
// ! correctly sized resulting matrix but the correctness of the units have yet
123
128
// ! to be proven, nor whether its systematic usage is in fact appropriate.
124
129
// ! Hypothesis: units are incorrect, usage may be incorrect, for example
125
- // ! `state_transition` may actually be unit-less. Note the lhs column size and
126
- // ! rhs row size are the resulting type's column and row sizes, respectively:
130
+ // ! `state_transition` may actually be unit-less. Note the ` lhs` column size and
131
+ // ! ` rhs` row size are the resulting type's column and row sizes, respectively:
127
132
// ! Lhs [m by n] and Rhs [o by n] -> Result [m by o].
128
133
// ! @todo Is there a better, simpler, canonical, standard way of doing this type
129
- // ! deductions ?
134
+ // ! deduction ?
130
135
struct deducer final {
131
- // Built-in's types deductions .
136
+ // Built-in, arithmetic, standard division support .
132
137
template <arithmetic Lhs, arithmetic Rhs>
133
138
[[nodiscard]] inline constexpr auto operator ()(const Lhs &lhs,
134
139
const Rhs &rhs) const
135
140
-> decltype(lhs / rhs);
136
141
137
- // Eigen's types deductions.
138
- template <typename Lhs, typename Rhs>
139
- requires requires (Lhs lhs, Rhs rhs) {
140
- typename Lhs::PlainMatrix;
141
- typename Lhs::PlainMatrix;
142
- }
142
+ // Type-erased Eigen third party linear algebra support.
143
+ template <eigen Lhs, eigen Rhs>
143
144
[[nodiscard]] inline constexpr auto operator ()(const Lhs &lhs,
144
145
const Rhs &rhs) const ->
145
146
typename decltype(lhs * rhs.transpose())::PlainMatrix;
146
147
147
- template <typename Lhs, arithmetic Rhs>
148
- requires requires (Lhs lhs) { typename Lhs::PlainMatrix; }
148
+ template <eigen Lhs, arithmetic Rhs>
149
149
[[nodiscard]] inline constexpr auto operator ()(const Lhs &lhs,
150
150
const Rhs &rhs) const ->
151
151
typename Lhs::PlainMatrix;
152
152
153
- template <arithmetic Lhs, typename Rhs>
154
- requires requires (Rhs rhs) { typename Rhs::PlainMatrix; }
153
+ template <arithmetic Lhs, eigen Rhs>
155
154
[[nodiscard]] inline constexpr auto operator ()(const Lhs &lhs,
156
155
const Rhs &rhs) const ->
157
156
typename decltype(rhs.transpose())::PlainMatrix;
0 commit comments