aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/autodiff.cpp
diff options
context:
space:
mode:
authorGravatar Thomas Capricelli <orzel@freehackers.org>2009-09-27 23:54:06 +0200
committerGravatar Thomas Capricelli <orzel@freehackers.org>2009-09-27 23:54:06 +0200
commit251c0f45ac275d6635a9453d6df65c9d749ef245 (patch)
treeb052da048134af053f43ff4975c4a8380baa4240 /unsupported/test/autodiff.cpp
parent92480ffd265475a25070b8ea9dfbc8536d038378 (diff)
remove references to adolc and split tests functions for clarity
Diffstat (limited to 'unsupported/test/autodiff.cpp')
-rw-r--r--unsupported/test/autodiff.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/unsupported/test/autodiff.cpp b/unsupported/test/autodiff.cpp
index 43ef1a308..b1164897c 100644
--- a/unsupported/test/autodiff.cpp
+++ b/unsupported/test/autodiff.cpp
@@ -111,7 +111,7 @@ struct TestFunc1
}
};
-template<typename Func> void adolc_forward_jacobian(const Func& f)
+template<typename Func> void forward_jacobian(const Func& f)
{
typename Func::InputType x = Func::InputType::Random(f.inputs());
typename Func::ValueType y(f.values()), yref(f.values());
@@ -134,21 +134,29 @@ template<typename Func> void adolc_forward_jacobian(const Func& f)
VERIFY_IS_APPROX(j, jref);
}
-void test_autodiff()
+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";
+}
+void test_autodiff_jacobian()
+{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST(( adolc_forward_jacobian(TestFunc1<double,2,2>()) ));
- CALL_SUBTEST(( adolc_forward_jacobian(TestFunc1<double,2,3>()) ));
- CALL_SUBTEST(( adolc_forward_jacobian(TestFunc1<double,3,2>()) ));
- CALL_SUBTEST(( adolc_forward_jacobian(TestFunc1<double,3,3>()) ));
- CALL_SUBTEST(( adolc_forward_jacobian(TestFunc1<double>(3,3)) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,2,2>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,2,3>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,3,2>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,3,3>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double>(3,3)) ));
}
-
-// exit(1);
}
+
+void test_autodiff()
+{
+ test_autodiff_scalar();
+ test_autodiff_jacobian();
+}
+