diff options
author | Sascha Haeberling <haeberling@google.com> | 2013-07-23 19:00:21 -0700 |
---|---|---|
committer | Sascha Haeberling <haeberling@google.com> | 2013-07-24 12:00:09 -0700 |
commit | 1d2624a10e2c559f8ba9ef89eaa30832c0a83a96 (patch) | |
tree | f43667ef858dd0f377b15a58a9d5c9a126762c55 /examples/quadratic_auto_diff.cc | |
parent | 0ae28bd5885b5daa526898fcf7c323dc2c3e1963 (diff) | |
download | ceres-solver-1d2624a10e2c559f8ba9ef89eaa30832c0a83a96.tar.gz |
Update ceres to the latest version in google3.
Change-Id: I0165fffa55f60714f23e0096eac89fa68df75a05
Diffstat (limited to 'examples/quadratic_auto_diff.cc')
-rw-r--r-- | examples/quadratic_auto_diff.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/quadratic_auto_diff.cc b/examples/quadratic_auto_diff.cc index ea7fae9..1e2f3ef 100644 --- a/examples/quadratic_auto_diff.cc +++ b/examples/quadratic_auto_diff.cc @@ -44,10 +44,11 @@ using ceres::Problem; using ceres::Solver; using ceres::Solve; -// A templated cost function that implements the residual r = 10 - x. The method -// Map is templated so that we can then use an automatic differentiation wrapper -// around it to generate its derivatives. -class QuadraticCostFunction { +// A templated cost functor that implements the residual r = 10 - +// x. The method operator() is templated so that we can then use an +// automatic differentiation wrapper around it to generate its +// derivatives. +class QuadraticCostFunctor { public: template <typename T> bool operator()(const T* const x, T* residual) const { residual[0] = T(10.0) - x[0]; @@ -69,8 +70,8 @@ int main(int argc, char** argv) { // Set up the only cost function (also known as residual). This uses // auto-differentiation to obtain the derivative (jacobian). problem.AddResidualBlock( - new AutoDiffCostFunction<QuadraticCostFunction, 1, 1>( - new QuadraticCostFunction), + new AutoDiffCostFunction<QuadraticCostFunctor, 1, 1>( + new QuadraticCostFunctor), NULL, &x); |