gtsam/matlab/EQUALITY.m

15 lines
315 B
Matlab
Raw Normal View History

2012-06-16 11:59:12 +08:00
function EQUALITY(name,expected,actual,tol)
2011-11-04 08:27:43 +08:00
% test equality of two vectors/matrices up to tolerance
if nargin<4,tol=1e-9;end
2012-06-16 11:59:12 +08:00
assertion = size(expected)==size(actual);
2011-11-04 08:27:43 +08:00
if assertion
2012-06-16 11:59:12 +08:00
assertion = all(abs(expected-actual)<tol);
2011-11-04 08:27:43 +08:00
end
if (assertion~=1)
2012-06-16 11:59:12 +08:00
warning(['EQUALITY ' name ' fails']);
expected
actual
2011-11-04 08:27:43 +08:00
end