Skip to content

Commit

Permalink
generalize check_equality() function to arbitrary matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Oct 28, 2015
1 parent eb6f393 commit a0f0135
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/test.h
Expand Up @@ -134,19 +134,21 @@ void check_equality(const softsusy::DoubleMatrix& b,
}
}

void check_equality(const Eigen::Matrix<double,3,3>& a,
const Eigen::Matrix<double,3,3>& b,
template <typename Scalar, int M, int N>
void check_equality(const Eigen::Matrix<Scalar,M,N>& a,
const Eigen::Matrix<Scalar,M,N>& b,
const std::string& testMsg, double max_dev)
{
for (int i = 0; i < 3; ++i) {
for (int l = 0; l < 3; ++l) {
for (int i = 0; i < M; ++i) {
for (int l = 0; l < N; ++l) {
std::ostringstream element;
element << testMsg << " [element " << i << "," << l << "]";
check_equality(a(i,l), b(i,l), element.str(), max_dev);
}
}
}


template <int NRows, int NCols>
void check_equality(const Eigen::Array<double,NRows,NCols>& a,
const Eigen::Array<double,NRows,NCols>& b,
Expand Down

0 comments on commit a0f0135

Please sign in to comment.