~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

Viewing changes to extern/libmv/third_party/ceres/include/ceres/numeric_diff_cost_function.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
// To get an numerically differentiated cost function, you must define
37
37
// a class with a operator() (a functor) that computes the residuals.
38
38
//
39
 
// The function must write the computed value in the last argument (the only
40
 
// non-const one) and return true to indicate success.
 
39
// The function must write the computed value in the last argument
 
40
// (the only non-const one) and return true to indicate success.
 
41
// Please see cost_function.h for details on how the return value
 
42
// maybe used to impose simple constraints on the parameter block.
41
43
//
42
44
// For example, consider a scalar error e = k - x'y, where both x and y are
43
45
// two-dimensional column vector parameters, the prime sign indicates
80
82
//
81
83
//   CostFunction* cost_function
82
84
//       = new NumericDiffCostFunction<MyScalarCostFunctor, CENTRAL, 1, 2, 2>(
83
 
//           new MyScalarCostFunctor(1.0));                          ^  ^  ^
84
 
//                                                               |   |  |  |
85
 
//                                   Finite Differencing Scheme -+   |  |  |
86
 
//                                   Dimension of residual ----------+  |  |
87
 
//                                   Dimension of x --------------------+  |
88
 
//                                   Dimension of y -----------------------+
 
85
//           new MyScalarCostFunctor(1.0));                    ^     ^  ^  ^
 
86
//                                                             |     |  |  |
 
87
//                                 Finite Differencing Scheme -+     |  |  |
 
88
//                                 Dimension of residual ------------+  |  |
 
89
//                                 Dimension of x ----------------------+  |
 
90
//                                 Dimension of y -------------------------+
89
91
//
90
 
// In this example, there is usually an instance for each measumerent of k.
 
92
// In this example, there is usually an instance for each measurement of k.
91
93
//
92
94
// In the instantiation above, the template parameters following
93
95
// "MyScalarCostFunctor", "1, 2, 2", describe the functor as computing
124
126
// To get a numerically differentiated cost function, define a
125
127
// subclass of CostFunction such that the Evaluate() function ignores
126
128
// the jacobian parameter. The numeric differentiation wrapper will
127
 
// fill in the jacobian parameter if nececssary by repeatedly calling
 
129
// fill in the jacobian parameter if necessary by repeatedly calling
128
130
// the Evaluate() function with small changes to the appropriate
129
131
// parameters, and computing the slope. For performance, the numeric
130
132
// differentiation wrapper class is templated on the concrete cost
146
148
#ifndef CERES_PUBLIC_NUMERIC_DIFF_COST_FUNCTION_H_
147
149
#define CERES_PUBLIC_NUMERIC_DIFF_COST_FUNCTION_H_
148
150
 
149
 
#include <glog/logging.h>
150
151
#include "Eigen/Dense"
151
152
#include "ceres/cost_function.h"
152
153
#include "ceres/internal/numeric_diff.h"
153
154
#include "ceres/internal/scoped_ptr.h"
154
155
#include "ceres/sized_cost_function.h"
155
156
#include "ceres/types.h"
 
157
#include "glog/logging.h"
156
158
 
157
159
namespace ceres {
158
160
 
230
232
    if (N5) parameters_reference_copy[5] = parameters_reference_copy[4] + N4;
231
233
    if (N6) parameters_reference_copy[6] = parameters_reference_copy[5] + N5;
232
234
    if (N7) parameters_reference_copy[7] = parameters_reference_copy[6] + N6;
233
 
    if (N7) parameters_reference_copy[8] = parameters_reference_copy[7] + N7;
234
 
    if (N8) parameters_reference_copy[9] = parameters_reference_copy[8] + N8;
 
235
    if (N8) parameters_reference_copy[8] = parameters_reference_copy[7] + N7;
 
236
    if (N9) parameters_reference_copy[9] = parameters_reference_copy[8] + N8;
235
237
 
236
238
#define COPY_PARAMETER_BLOCK(block)                                     \
237
239
  if (N ## block) memcpy(parameters_reference_copy[block],              \