6 #ifndef PROJECT_MATHUTILITIES_H 7 #define PROJECT_MATHUTILITIES_H 9 #include <eigen3/Eigen/Dense> 22 template <
typename T,
typename T2>
23 bool almostEqual(
const Eigen::MatrixBase<T>& a,
const Eigen::MatrixBase<T>& b,
25 long x = T::RowsAtCompileTime;
26 long y = T::ColsAtCompileTime;
28 if (T::RowsAtCompileTime == Eigen::Dynamic ||
29 T::ColsAtCompileTime == Eigen::Dynamic) {
30 assert(a.rows() == b.rows());
31 assert(a.cols() == b.cols());
36 for (
long i = 0; i < x; i++) {
37 for (
long j = 0; j < y; j++) {
38 T2 error = std::abs(a(i, j) - b(i, j));
39 if (error >= tol)
return false;
45 #endif // PROJECT_MATHUTILITIES_H
bool almostEqual(const Eigen::MatrixBase< T > &a, const Eigen::MatrixBase< T > &b, T2 tol)