diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-12-04 12:40:29 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-12-04 12:40:29 +0100 |
commit | ea684af6b41cdcfd9a8d2edbda37a866827e5347 (patch) | |
tree | 0f3b9b03a1803327dab5b468e44152666304b58e /unsupported/test/autodiff.cpp | |
parent | 7aad4341609260356845b16057fd581302c5072f (diff) | |
parent | ffaea19a70d22657008645e97a0b9efe2fcc9451 (diff) |
merge
Diffstat (limited to 'unsupported/test/autodiff.cpp')
-rw-r--r-- | unsupported/test/autodiff.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/unsupported/test/autodiff.cpp b/unsupported/test/autodiff.cpp index a96927b41..cac08cd4b 100644 --- a/unsupported/test/autodiff.cpp +++ b/unsupported/test/autodiff.cpp @@ -31,7 +31,7 @@ EIGEN_DONT_INLINE Scalar foo(const Scalar& x, const Scalar& y) // return x+std::sin(y); EIGEN_ASM_COMMENT("mybegin"); return static_cast<Scalar>(x*2 - std::pow(x,2) + 2*std::sqrt(y*y) - 4 * std::sin(x) + 2 * std::cos(y) - std::exp(-0.5*x*x)); -// return y/x;// - y*2; +// return x - y;//x*2 -std::pow(x,2);//(2*y/x);// - y*2; EIGEN_ASM_COMMENT("myend"); } @@ -137,10 +137,12 @@ template<typename Func> void forward_jacobian(const Func& f) void test_autodiff_scalar() { std::cerr << foo<float>(1,2) << "\n"; - AutoDiffScalar<Vector2f> ax(1,Vector2f::UnitX()); - AutoDiffScalar<Vector2f> ay(2,Vector2f::UnitY()); - std::cerr << foo<AutoDiffScalar<Vector2f> >(ax,ay).value() << " <> " - << foo<AutoDiffScalar<Vector2f> >(ax,ay).derivatives().transpose() << "\n\n"; + typedef AutoDiffScalar<Vector2f> AD; + AD ax(1,Vector2f::UnitX()); + AD ay(2,Vector2f::UnitY()); + foo<AD>(ax,ay); + std::cerr << foo<AD>(ax,ay).value() << " <> " + << foo<AD>(ax,ay).derivatives().transpose() << "\n\n"; } void test_autodiff_jacobian() |