Skip to content

Commit

Permalink
Refactor MatrixLike concept
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed May 16, 2024
1 parent d41089d commit 3de8593
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/sleipnir/util/Concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ template <typename T>
concept ScalarLike = std::same_as<T, double> || std::same_as<T, int> ||
std::same_as<T, Variable>;

template <typename T>
concept SleipnirMatrixLike = std::same_as<T, VariableMatrix> ||
std::same_as<T, VariableBlock<VariableMatrix>>;

template <typename Derived>
concept EigenMatrixLike =
std::derived_from<Derived, Eigen::MatrixBase<Derived>>;
Expand All @@ -23,8 +27,6 @@ template <typename T>
concept EigenSolver = requires(T t) { t.solve(Eigen::VectorXd{}); };

template <typename T>
concept MatrixLike =
std::same_as<T, VariableMatrix> ||
std::same_as<T, VariableBlock<VariableMatrix>> || EigenMatrixLike<T>;
concept MatrixLike = SleipnirMatrixLike<T> || EigenMatrixLike<T>;

} // namespace sleipnir

0 comments on commit 3de8593

Please sign in to comment.