[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46488] branches/soc-2011-tomato/extern/ libmv/third_party/ceres: Tomato: re-integrate ceres library with updates needed for tracking improvement

Sergey Sharybin sergey.vfx at gmail.com
Thu May 10 12:18:00 CEST 2012


Revision: 46488
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46488
Author:   nazgul
Date:     2012-05-10 10:17:59 +0000 (Thu, 10 May 2012)
Log Message:
-----------
Tomato: re-integrate ceres library with updates needed for tracking improvement
Also commit missed patch.

Modified Paths:
--------------
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/CMakeLists.txt
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/ChangeLog
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/autodiff_cost_function.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/internal/autodiff.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/sized_cost_function.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/solver.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/types.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/block_sparse_matrix.cc
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/block_sparse_matrix.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/compressed_row_sparse_matrix.cc
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/compressed_row_sparse_matrix.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/dense_sparse_matrix.cc
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/dense_sparse_matrix.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/levenberg_marquardt.cc
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/linear_least_squares_problems.cc
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/linear_least_squares_problems.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/minimizer.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/sparse_matrix.h
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/triplet_sparse_matrix.cc
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/internal/ceres/triplet_sparse_matrix.h

Added Paths:
-----------
    branches/soc-2011-tomato/extern/libmv/third_party/ceres/patches/msvc_isfinite.patch

Modified: branches/soc-2011-tomato/extern/libmv/third_party/ceres/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/extern/libmv/third_party/ceres/CMakeLists.txt	2012-05-10 09:05:03 UTC (rev 46487)
+++ branches/soc-2011-tomato/extern/libmv/third_party/ceres/CMakeLists.txt	2012-05-10 10:17:59 UTC (rev 46488)
@@ -208,11 +208,11 @@
 endif()
 
 add_definitions(
-    -DCERES_HAVE_PTHREAD
-    -D"CERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {"
-    -D"CERES_HASH_NAMESPACE_END=}}"
-    -DCERES_NO_SUITESPARSE
-    -DCERES_DONT_HAVE_PROTOCOL_BUFFERS
+	-DCERES_HAVE_PTHREAD
+	-D"CERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {"
+	-D"CERES_HASH_NAMESPACE_END=}}"
+	-DCERES_NO_SUITESPARSE
+	-DCERES_DONT_HAVE_PROTOCOL_BUFFERS
 )
 
 blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}")

Modified: branches/soc-2011-tomato/extern/libmv/third_party/ceres/ChangeLog
===================================================================
--- branches/soc-2011-tomato/extern/libmv/third_party/ceres/ChangeLog	2012-05-10 09:05:03 UTC (rev 46487)
+++ branches/soc-2011-tomato/extern/libmv/third_party/ceres/ChangeLog	2012-05-10 10:17:59 UTC (rev 46488)
@@ -1,3 +1,100 @@
+commit ca72152362ae1f4b9928c012e74b4d49d094a4ca
+Merge: d297f8d 0a04199
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Wed May 9 13:10:59 2012 -0700
+
+    Merge branch 'master' into windows
+
+commit 0a04199ef279cc9ea97f665fed8e7fae717813c3
+Merge: fdeb577 f2571f1
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Wed May 9 12:54:56 2012 -0700
+
+    Merge branch 'master' of https://code.google.com/p/ceres-solver
+
+commit fdeb5772cc5eeebca4d776d220d80cc91b6d0f74
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Wed May 9 07:38:07 2012 -0700
+
+    Support varying numbers of residuals in autodiff.
+    
+    This commit modifies the only function in autodiff that takes a
+    templated number of outputs (i.e. residuals) and makes that
+    template parameter a normal parameter. With that change, it
+    is a trivial matter to support a dynamic number of residuals.
+    
+    The API for dynamic residuals is to pass a fake number of
+    residuals as the second template argument to
+    AutoDiffCostFunction, and to pass the real number of
+    parameters as a second constructor argument.
+
+commit da3e0563cc12e08e7b3e0fbf11d9cc8cfe9658aa
+Author: Sameer Agarwal <sameeragarwal at google.com>
+Date:   Wed May 9 11:57:47 2012 -0700
+
+    Typo corrections in the documentation from Bing
+
+commit aa9526d8e8fb34c23d63e3af5bf9239b0c4ea603
+Author: Sameer Agarwal <sameeragarwal at google.com>
+Date:   Tue May 8 21:22:09 2012 -0700
+
+    Share search paths across various library searches.
+    Fix typos in glog search.
+    Split the error messages for include and lib.
+    Enable building of tests by default.
+    Made building on homebrew installations a bit better.
+    Remove temporary variables for glog and gflags.
+
+commit f2571f186850ed3dd316236ac4be488979df7d30
+Author: Sameer Agarwal <sameeragarwal at google.com>
+Date:   Wed May 9 11:57:47 2012 -0700
+
+    Typo corrections in the documentation from Bing
+
+commit 8f7f11ff7d07737435428a2620c52419cf99f98e
+Merge: e6c17c4 eaccbb3
+Author: Sameer Agarwal <sameeragarwal at google.com>
+Date:   Wed May 9 11:34:15 2012 -0700
+
+    Merge branch 'master' of https://code.google.com/p/ceres-solver
+
+commit e6c17c4c9d9307218f6f739cea39bc2d87733d4d
+Author: Sameer Agarwal <sameeragarwal at google.com>
+Date:   Tue May 8 21:22:09 2012 -0700
+
+    Share search paths across various library searches.
+    Fix typos in glog search.
+    Split the error messages for include and lib.
+    Enable building of tests by default.
+    Made building on homebrew installations a bit better.
+    Remove temporary variables for glog and gflags.
+
+commit eaccbb345614c0d24c5e21fa931f470cfda874df
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Wed May 9 05:31:29 2012 -0700
+
+    Remove unused template parameter from VariadicEvaluate.
+
+commit 82f4b88c34b0b2cf85064e5fc20e374e978b2e3b
+Author: Sameer Agarwal <sameeragarwal at google.com>
+Date:   Sun May 6 21:05:28 2012 -0700
+
+    Extend support writing linear least squares problems to disk.
+    
+    1. Make the mechanism for writing problems to disk, generic and
+    controllable using an enum DumpType visible in the API.
+    
+    2. Instead of single file containing protocol buffers, now matrices can
+    be written in a matlab/octave friendly format. This is now the default.
+    
+    3. The support for writing problems to disk is moved into
+    linear_least_squares_problem.cc/h
+    
+    4. SparseMatrix now has a ToTextFile virtual method which is
+    implemented by each of its subclasses to write a (i,j,s) triplets.
+    
+    5. Minor changes to simple_bundle_adjuster to enable logging at startup.
+
 commit d297f8d3d3f5025c24752f0f4c1ec2469a769f99
 Merge: 7e74d81 f8bd7fa
 Author: Keir Mierle <mierle at gmail.com>

Modified: branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/autodiff_cost_function.h
===================================================================
--- branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/autodiff_cost_function.h	2012-05-10 09:05:03 UTC (rev 46487)
+++ branches/soc-2011-tomato/extern/libmv/third_party/ceres/include/ceres/autodiff_cost_function.h	2012-05-10 10:17:59 UTC (rev 46488)
@@ -93,6 +93,20 @@
 // "MyScalarCostFunction", "1, 2, 2", describe the functor as computing a
 // 1-dimensional output from two arguments, both 2-dimensional.
 //
+// The autodiff cost function also supports cost functions with a
+// runtime-determined number of residuals. For example:
+//
+//   CostFunction* cost_function
+//       = new AutoDiffCostFunction<MyScalarCostFunction, DYNAMIC, 2, 2>(
+//           new CostFunctionWithDynamicNumResiduals(1.0),   ^     ^  ^
+//           runtime_number_of_residuals); <----+            |     |  |
+//                                              |            |     |  |
+//                                              |            |     |  |
+//             Actual number of residuals ------+            |     |  |
+//             Indicate dynamic number of residuals ---------+     |  |
+//             Dimension of x -------------------------------------+  |
+//             Dimension of y ----------------------------------------+
+//
 // The framework can currently accommodate cost functions of up to 6 independent
 // variables, and there is no limit on the dimensionality of each of them.
 //
@@ -115,18 +129,26 @@
 #include "ceres/internal/autodiff.h"
 #include "ceres/internal/scoped_ptr.h"
 #include "ceres/sized_cost_function.h"
+#include "ceres/types.h"
 
 namespace ceres {
 
-// A cost function which computes the derivative of the cost with respect to the
-// parameters (a.k.a. the jacobian) using an autodifferentiation framework. The
-// first template argument is the functor object, described in the header
-// comment. The second argument is the dimension of the residual, and subsequent
+// A cost function which computes the derivative of the cost with respect to
+// the parameters (a.k.a. the jacobian) using an autodifferentiation framework.
+// The first template argument is the functor object, described in the header
+// comment. The second argument is the dimension of the residual (or
+// ceres::DYNAMIC to indicate it will be set at runtime), and subsequent
 // arguments describe the size of the Nth parameter, one per parameter.
 //
-// The constructor, which takes a cost functor, takes ownership of the functor.
+// The constructors take ownership of the cost functor.
+//
+// If the number of residuals (argument "M" below) is ceres::DYNAMIC, then the
+// two-argument constructor must be used. The second constructor takes a number
+// of residuals (in addition to the templated number of residuals). This allows
+// for varying the number of residuals for a single autodiff cost function at
+// runtime.
 template <typename CostFunctor,
-          int M,        // Number of residuals.
+          int M,        // Number of residuals, or ceres::DYNAMIC.
           int N0,       // Number of parameters in block 0.
           int N1 = 0,   // Number of parameters in block 1.
           int N2 = 0,   // Number of parameters in block 2.
@@ -136,9 +158,26 @@
 class AutoDiffCostFunction :
   public SizedCostFunction<M, N0, N1, N2, N3, N4, N5> {
  public:
-  // Takes ownership of functor.
-  explicit AutoDiffCostFunction(CostFunctor* functor) : functor_(functor) {}
+  // Takes ownership of functor. Uses the template-provided value for the
+  // number of residuals ("M").
+  explicit AutoDiffCostFunction(CostFunctor* functor)
+      : functor_(functor) {
+    CHECK_NE(M, DYNAMIC) << "Can't run the fixed-size constructor if the "
+                          << "number of residuals is set to ceres::DYNAMIC.";
+  }
 
+  // Takes ownership of functor. Ignores the template-provided number of
+  // residuals ("M") in favor of the "num_residuals" argument provided.
+  //
+  // This allows for having autodiff cost functions which return varying
+  // numbers of residuals at runtime.
+  AutoDiffCostFunction(CostFunctor* functor, int num_residuals)
+      : functor_(functor) {
+    CHECK_EQ(M, DYNAMIC) << "Can't run the dynamic-size constructor if the "
+                          << "number of residuals is not ceres::DYNAMIC.";
+    SizedCostFunction<M, N0, N1, N2, N3, N4, N5>::set_num_residuals(num_residuals);
+  }
+
   virtual ~AutoDiffCostFunction() {}
 
   // Implementation details follow; clients of the autodiff cost function should
@@ -151,14 +190,16 @@
                         double** jacobians) const {
     if (!jacobians) {
       return internal::VariadicEvaluate<
-          CostFunctor, double, M, N0, N1, N2, N3, N4, N5>
+          CostFunctor, double, N0, N1, N2, N3, N4, N5>
           ::Call(*functor_, parameters, residuals);
     }
     return internal::AutoDiff<CostFunctor, double,
-           M, N0, N1, N2, N3, N4, N5>::Differentiate(*functor_,
-                                                     parameters,
-                                                     residuals,
-                                                     jacobians);
+           N0, N1, N2, N3, N4, N5>::Differentiate(
+               *functor_,
+               parameters,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list