Added assert_inequal for matrices

release/4.3a0
Alex Cunningham 2013-04-18 18:12:37 +00:00
parent ddea66e026
commit 88d3def0db
2 changed files with 14 additions and 0 deletions

View File

@ -105,6 +105,15 @@ bool assert_equal(const Matrix& expected, const Matrix& actual, double tol) {
return false;
}
/* ************************************************************************* */
bool assert_inequal(const Matrix& A, const Matrix& B, double tol) {
if (!equal_with_abs_tol(A,B,tol)) return true;
cout << "Erroneously equal:" << endl;
print(A, "A = ");
print(B, "B = ");
return false;
}
/* ************************************************************************* */
bool assert_equal(const std::list<Matrix>& As, const std::list<Matrix>& Bs, double tol) {
if (As.size() != Bs.size()) return false;

View File

@ -134,6 +134,11 @@ inline bool operator!=(const Matrix& A, const Matrix& B) {
*/
GTSAM_EXPORT bool assert_equal(const Matrix& A, const Matrix& B, double tol = 1e-9);
/**
* inequals with an tolerance, prints out message if within tolerance
*/
GTSAM_EXPORT bool assert_inequal(const Matrix& A, const Matrix& B, double tol = 1e-9);
/**
* equals with an tolerance, prints out message if unequal
*/