Skip to content

Commit

Permalink
add the check in testClosestExpmap, to handle the test failure when e…
Browse files Browse the repository at this point in the history
…xpmap2 is very small, such that closestExpmap has a big gradient
  • Loading branch information
hongkai-dai committed Jul 29, 2015
1 parent 6ed71b3 commit f76b843
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion util/test/testClosestExpmap.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ function testClosestExpmap_userfun(w1,w2)
end
valuecheck(abs(expmap2quat(w2)'*expmap2quat(w2_closest)),1,1e-3);
[~,dw2_closest_dw2_numeric] = geval(@(w2) closestExpmap(w1,w2),w2,struct('grad_method','numerical'));
valuecheck(dw2_closest_dw2,dw2_closest_dw2_numeric,1e-2);
if(~valuecheck(dw2_closest_dw2,dw2_closest_dw2_numeric,1e-2) && ~valuecheck((dw2_closest_dw2-dw2_closest_dw2_numeric)*w2,zeros(3,1),1e-2));
error('The analytical gradient of closestExpmap does not match the numeric gradient');
end
end

0 comments on commit f76b843

Please sign in to comment.