bug #1222: fix compilation in AutoDiffScalar and add respective unit test
(grafted from 448d9d943c
)
This commit is contained in:
parent
51f763eaba
commit
17c40e5524
@ -162,6 +162,15 @@ void test_autodiff_jacobian()
|
|||||||
CALL_SUBTEST(( forward_jacobian(TestFunc1<double>(3,3)) ));
|
CALL_SUBTEST(( forward_jacobian(TestFunc1<double>(3,3)) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double bug_1222() {
|
||||||
|
typedef Eigen::AutoDiffScalar<Eigen::Vector3d> AD;
|
||||||
|
const double _cv1_3 = 1.0;
|
||||||
|
const AD chi_3 = 1.0;
|
||||||
|
// this line did not work, because operator+ returns ADS<DerType&>, which then cannot be converted to ADS<DerType>
|
||||||
|
const AD denom = chi_3 + _cv1_3;
|
||||||
|
return denom.value();
|
||||||
|
}
|
||||||
|
|
||||||
void test_autodiff()
|
void test_autodiff()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < g_repeat; i++) {
|
for(int i = 0; i < g_repeat; i++) {
|
||||||
@ -169,5 +178,7 @@ void test_autodiff()
|
|||||||
CALL_SUBTEST_2( test_autodiff_vector() );
|
CALL_SUBTEST_2( test_autodiff_vector() );
|
||||||
CALL_SUBTEST_3( test_autodiff_jacobian() );
|
CALL_SUBTEST_3( test_autodiff_jacobian() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bug_1222();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user