Provide actual unit tests for autodiff-module
Submitted by Matt
Assigned to Matt
Link to original bugzilla bug (#781)
Version: 3.2
Description
Created attachment 448
Patch (diff)
There's a minor bug (typo) in "unsupported/test/autodiff.cpp" which prevents the agreement of Vector2f
and AutoDiffScalar<Vector2f>
results in function test_autodiff_vector
.
Namely, this is the function call for the first case:
foo<Vector2f>(Vector2f(1,2))
While this is the argument for the second case:
VectorAD p(AD(1),AD(-1));
and its subsequent use:
AD res = foo<VectorAD>(p);
.
This results in res.value()
(and derivatives, naturally), to deviate from the non-AD result (which has been computed for (1,2) -- but is then compared with (1,-1)).
A proposed minimal patch changes the following definition:
VectorAD p(AD(1),AD(-1));
to this:
VectorAD p(AD(1),AD(2));
.
This results in the test producing results that are in agreement.
// Confirmed with Eigen 3.2.1, may also affect other versions.
Attachment 448, "Patch (diff)":
autodiff.cpp.diff