From 729b76eb79d1c012bdd5e7094d700774e7e805e9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 21 Mar 2013 18:07:03 +0000 Subject: Update ceres to current git version. Mainly to support msvc2010, bit also includes some minor fixes. --- extern/libmv/third_party/ceres/ChangeLog | 372 ++++++++++----------- .../ceres/include/ceres/cost_function_to_functor.h | 10 +- .../ceres/include/ceres/internal/autodiff.h | 4 +- .../ceres/include/ceres/numeric_diff_functor.h | 10 +- .../third_party/ceres/include/ceres/problem.h | 2 +- .../third_party/ceres/include/ceres/rotation.h | 18 +- .../internal/ceres/canonical_views_clustering.cc | 4 + .../internal/ceres/canonical_views_clustering.h | 3 + .../ceres/generate_eliminator_specialization.py | 51 +-- .../ceres/generated/schur_eliminator_2_2_2.cc | 3 + .../ceres/generated/schur_eliminator_2_2_3.cc | 3 + .../ceres/generated/schur_eliminator_2_2_4.cc | 3 + .../ceres/generated/schur_eliminator_2_2_d.cc | 3 + .../ceres/generated/schur_eliminator_2_3_3.cc | 3 + .../ceres/generated/schur_eliminator_2_3_4.cc | 3 + .../ceres/generated/schur_eliminator_2_3_9.cc | 3 + .../ceres/generated/schur_eliminator_2_3_d.cc | 3 + .../ceres/generated/schur_eliminator_2_4_3.cc | 3 + .../ceres/generated/schur_eliminator_2_4_4.cc | 3 + .../ceres/generated/schur_eliminator_2_4_d.cc | 3 + .../ceres/generated/schur_eliminator_4_4_2.cc | 3 + .../ceres/generated/schur_eliminator_4_4_3.cc | 3 + .../ceres/generated/schur_eliminator_4_4_4.cc | 3 + .../ceres/generated/schur_eliminator_4_4_d.cc | 3 + .../ceres/generated/schur_eliminator_d_d_d.cc | 2 +- .../ceres/internal/ceres/line_search.cc | 3 + .../third_party/ceres/internal/ceres/line_search.h | 3 + .../ceres/internal/ceres/line_search_direction.cc | 4 + .../ceres/internal/ceres/line_search_direction.h | 3 + .../ceres/internal/ceres/line_search_minimizer.cc | 4 + .../ceres/internal/ceres/line_search_minimizer.h | 3 + .../ceres/internal/ceres/problem_impl.cc | 37 +- .../internal/ceres/schur_complement_solver.cc | 4 +- .../ceres/internal/ceres/schur_complement_solver.h | 3 +- .../ceres/internal/ceres/schur_eliminator.cc | 33 +- .../ceres/internal/ceres/solver_impl.cc | 13 +- .../third_party/ceres/internal/ceres/solver_impl.h | 37 +- .../ceres/sparse_normal_cholesky_solver.cc | 6 +- .../internal/ceres/sparse_normal_cholesky_solver.h | 3 + .../third_party/ceres/internal/ceres/visibility.cc | 4 + .../third_party/ceres/internal/ceres/visibility.h | 3 + .../ceres/visibility_based_preconditioner.cc | 9 +- 42 files changed, 414 insertions(+), 279 deletions(-) (limited to 'extern') diff --git a/extern/libmv/third_party/ceres/ChangeLog b/extern/libmv/third_party/ceres/ChangeLog index 67a1cac9d76..458a045d8be 100644 --- a/extern/libmv/third_party/ceres/ChangeLog +++ b/extern/libmv/third_party/ceres/ChangeLog @@ -1,3 +1,179 @@ +commit f46de9e697eb5b8756084615e29ded48600a4d39 +Author: Sergey Sharybin +Date: Thu Mar 21 15:31:35 2013 +0600 + + Silent no previous declaration warning for FindParameterBlockOrDie + + Use anonymous namespace for this. Also move some surrounding static + function to this anonymous namespace. + + Change-Id: Ie235eb7936976563a9db115ec13c59e6e6869b96 + +commit 16636efeffacdd69d075a60ea8a94d98fd81c6fd +Author: Sergey Sharybin +Date: Thu Mar 21 15:12:01 2013 +0600 + + Compilation fix for msvc2010 + + Usage of back_inserter requires header when using msvc2010 + + Change-Id: I92ee1649795ce0468ce337fc414eb0ca6e90c51e + +commit ac0d416991274ed67fe85371f09b07f706a6db9a +Author: Pablo Speciale +Date: Wed Mar 20 18:32:14 2013 -0700 + + google-glog link wasn't working, 'http://' twice + + Change-Id: I9cd96d3609f9b1ba31cd480fef1702972be86741 + +commit 55b6c966c4f697cb5d11982201733aa3bce7a5a7 +Author: Pablo Speciale +Date: Wed Mar 20 17:44:04 2013 -0700 + + * Fixed the location of the Ceres doc (once installed with 'make install') + * Doing 'make ceres_docs' can be used to create the documentation (if the BUILD_DOCUMENTATION=ON) + * Included the copyright boilerplate for FindSphinx.cmake + + Change-Id: Iea21eba9e68384b4fe72c85fa88c76b0ba8a7a1d + +commit a986912555b304a47dd0c2a02892046fde15d091 +Author: Sameer Agarwal +Date: Wed Mar 20 11:50:34 2013 -0700 + + Update version history + + Change-Id: I238279719219a26d0d1bb32e0610f41007d3dcef + +commit 16dbf11626c52c013f1dca6375f993a554e31d51 +Author: Pablo Speciale +Date: Mon Mar 11 14:44:02 2013 -0700 + + Added CeresConfig.cmake based on this example: + https://projects.kde.org/projects/kde/kdeexamples/repository/revisions/master/show/buildsystem/HowToInstallALibrary + + Change-Id: I130cac5d43d9fbbf359abc04d3691e25c4e2bb63 + +commit 015d57f173fab7ea040ee01474101e208ff72be6 +Author: Pablo Speciale +Date: Tue Mar 19 14:05:14 2013 -0700 + + Avoiding the Warning: "deprecated conversion from string constant to char*" + + Change-Id: Ifa47f9b0724f79c5c695828628c89818ddefd844 + +commit c51b11c1046366035e7da95e4d8a78100ef3f153 +Author: Pablo Speciale +Date: Tue Mar 12 00:56:56 2013 -0700 + + Sphinx and CMake, based on this example: + http://ericscottbarr.com/blog/2012/03/sphinx-and-cmake-beautiful-documentation-for-c-projects/ + + The 'docs/CMakeLists.txt' file was deleted in this commit: 0abfb8f46f534b05413bb4d64b960d6fd0a9befb + + Thanks to Arnaud Gelas, he has passed some links: + https://github.com/InsightSoftwareConsortium/ITKExamples/blob/master/CMake/FindSphinx.cmake + https://github.com/InsightSoftwareConsortium/ITKExamples/blob/master/CMakeLists.txt#L120-L154 + + Change-Id: Ic65e7f8ec5280d1e71a897a144417a21761c5553 + +commit 793a339335d8d52279efb49bcd704d196646efb5 +Author: Sameer Agarwal +Date: Wed Mar 13 12:14:00 2013 -0700 + + Make Android.mk play better with the external consraints + + Change-Id: Ia0a1037d97c032a4ba1a9acbf4e04c192d12ee61 + +commit 700d50d8074f0273b305fe6d9f795f1dcb988048 +Author: Sameer Agarwal +Date: Tue Mar 12 16:12:42 2013 -0700 + + Lint cleanup from William Rucklidge + + Change-Id: Iacbf77246109f687708696eee7fb6144d23e7ec5 + +commit 8140f0fc979f5728f37cfb68362f31e7e37b46bb +Author: Sameer Agarwal +Date: Tue Mar 12 09:45:08 2013 -0700 + + Modularize the build. + + 1. Add -DLINE_SEARCH_MINIMIZER to CMake to make the line search + minimizer optional. + 2. Better handling of -DSUITESPARSE/-DCXSPARSE in top level cmake + file. + 3. Disable code which will never be used if SuiteSparse and/or + CXSparse is not available. + 4. Update build docs. + 5. Update jni/Android.mk + 6. Minor lint cleanup from William Rucklidge. + + Change-Id: If60460a858000df82faed7a6bb056dd2bfdde562 + +commit c59c1e44727c62d43523b672c1c132865cd25784 +Author: Sameer Agarwal +Date: Mon Mar 11 17:28:38 2013 -0700 + + Propagate ifdefs correctly to improve build efficiency. + + With -DRESTRICT_SCHUR_SPECIALIZATIONS, now the various + specializations are empty, decreasing build time and + reducing the size of the static library. + + Change-Id: I8ec431279741a9a83516a4167c54a364c4608143 + +commit 32874b861fc54b33aa4272e8c81bb001aa1e1e60 +Author: Yuliy Schwartzburg +Date: Fri Mar 8 11:30:44 2013 +0100 + + Fix CMake "LIB_SUFFIX" for non-linux installations + + Change-Id: Ieb8a2825a4378b388149e7934ecc7b96ba5a29fa + +commit 58b8c68f29c2c15edbc5f77102796df661020312 +Author: Sameer Agarwal +Date: Sat Mar 9 17:17:43 2013 -0800 + + Clean up rotation.h + + Change-Id: I3370c9883728cda068c9650a2c2a50641fd8299c + +commit 020d8e1e48f341f3b990ac449998d36aaca2771f +Author: Sameer Agarwal +Date: Wed Mar 6 16:19:26 2013 -0800 + + Better error reporting in the modeling API. + + More informative error when user passes an + unknown parameter block to Problem methods. + + Change-Id: I517360e4b0b55814904ca3e664877d76ad3f59e8 + +commit 5e7ce8a950cf5794c63817827ce66a3a4e66e7b6 +Author: Sameer Agarwal +Date: Wed Mar 6 11:38:41 2013 -0800 + + Fix Problem::Evaluate documentation + + Change-Id: I8c70a24743cff2d9cface99ef0f5d34c78f769c6 + +commit 0a4f5f8f7428148f21183e743d091d2079406604 +Author: Taylor Braun-Jones +Date: Wed Mar 6 00:00:32 2013 -0500 + + Fix operator() signature in several sections of the documentation + + Change-Id: I73f9d150a738f7b136fbc1f98fc60b0f306bd7f9 + +commit 2c648dbc43025927301684fc82d95ccf6b6c21bc +Author: Sameer Agarwal +Date: Tue Mar 5 15:20:15 2013 -0800 + + Make examples independent of ceres internals. + + Change-Id: I6b6913e067a86fea713646218c8da1439d349d74 + commit e7148795c3f2ce1f6625a7c81545707a6cbde3eb Author: Sameer Agarwal Date: Mon Mar 4 10:17:30 2013 -0800 @@ -429,199 +605,3 @@ Date: Fri Feb 15 14:26:56 2013 -0800 Solver::Summary::FullReport() supports line search now. Change-Id: Ib08d300198b85d9732cfb5785af4235ca4bd5226 - -commit fbbea464d1c9575d8224220d3e61f92d93fe9739 -Author: Sameer Agarwal -Date: Fri Feb 15 11:25:03 2013 -0800 - - Update documentation. - - Change-Id: Idb03741fab9facbbbda85d5a82723f0b4c1c6c60 - -commit 8e1f83c4c457fb7238eb342eab744c5570b73c4d -Author: Sameer Agarwal -Date: Fri Feb 15 08:35:40 2013 -0800 - - Speed up Problem construction and destruction. - - Change-Id: I3147b0b60eedf40f8453d5a39ff04a572c445a2f - -commit efb47f39c31f0ef1bb9c015c8c0d114153df6379 -Author: Sameer Agarwal -Date: Thu Feb 14 19:44:11 2013 -0800 - - Documentation update - - Change-Id: I0fec43bff4fe0ea6cd2d2a8b34dac2330a517da0 - -commit be418a336cae5672111e0f6989e6d8d6c1fa24a6 -Author: Markus Moll -Date: Fri Feb 15 17:19:28 2013 +0100 - - Fix evaluation of initial cost and corresponding test - - Commit f102a68e411d11b4864e17b69a2d781e9c2692ad seems to have introduced - a bug in both solver_impl.cc and solver_impl_test.cc - solver_impl_test showed 3 errors, where two were due to ceres NOT - failing when the test expected that, and one was due to the initial cost - being wrong (-1 instead of 0.5) - Ceres now does not attempt to evaluate the initial cost if - options.return_initial_xxx is not set. It therefore did not fail in - the tests. - It also seems that the CERES_EVALUATE macro erroneously always sets - final_cost, even when called with 'initial' as argument. - - Change-Id: Ia3c3eeb476e7023a3f80b201124010d6c67e9824 - -commit 974513a41ff1ddc671d3dc6aa09ce708bbe447da -Author: Sameer Agarwal -Date: Tue Feb 12 14:22:40 2013 -0800 - - Bug fix in DynamicAutoDiffCostFunction - - Add handling of constant parameter blocks. - - Change-Id: I8b2ea79f47e190604fc4bed27705798240689f71 - -commit 3130b3cea4028c71d9ae18b7465d7627f29fef7d -Author: Keir Mierle -Date: Mon Feb 11 19:39:29 2013 -0800 - - Add support for dynamic autodiff - - Change-Id: I17d573696172ab691a9653db99a620e4bc1bd0d0 - -commit c58e6dc3ea550302c8151003b17e9bc2a1acc316 -Author: Sameer Agarwal -Date: Mon Feb 11 16:41:06 2013 -0800 - - More refined event logging in solver_impl.cc - - Change-Id: Ie3061c921c006d2600d16185c690f52ccf816f68 - -commit f102a68e411d11b4864e17b69a2d781e9c2692ad -Author: Sameer Agarwal -Date: Mon Feb 11 15:08:40 2013 -0800 - - Remove extraneous initial and final evals. - - Change-Id: I80ed87435f399cbf452c68be7ea1e7139696aa4a - -commit 0593747ee09e21a9c0a2b604d51e21a6cdd21315 -Author: Sameer Agarwal -Date: Mon Feb 11 13:57:12 2013 -0800 - - Fix a memory leak in cxsparse.cc - - Thanks to Alexander Mordvintsev for reporting it. - - Change-Id: Ia872be42ce80209e46722fc16a928496cf97e256 - -commit 0abfb8f46f534b05413bb4d64b960d6fd0a9befb -Author: Sameer Agarwal -Date: Mon Feb 11 13:40:04 2013 -0800 - - Delete the tex documentation. - - Change-Id: I15c78a8b33c5fd94941238814ac023a8fb251a20 - -commit 085cd4a6641c404334d17e5ea38f9e5b68a06ba7 -Author: Sameer Agarwal -Date: Wed Feb 6 14:31:07 2013 -0800 - - Rewrite of the tutorial. - - 1. Quicker starting point. - 2. Better discussion of derivatives. - 3. Better hyperlinking to code and class documentation. - 4. New robust estimation example. - 5. Better naming of example code. - 6. Removed dependency on gflags in all the core examples covered - in the tutorial. - - Change-Id: Ibf3c7fe946fa2b4d22f8916a9366df267d34ca26 - -commit c0fdc9753909fc37fed2cb5e0fcc02fc65789d68 -Author: Sameer Agarwal -Date: Wed Feb 6 14:31:07 2013 -0800 - - Update nist.cc to better evaluate results. - - Ceres beats Minpack and HBN handily. - - Change-Id: I7df8a47b753202ed0b53ab128ce48466bf9f8083 - -commit d91b671798125fd4889914d92a29cf0f7a5fef21 -Author: Sameer Agarwal -Date: Wed Feb 6 01:08:40 2013 -0800 - - More small changes - More small changes to the docs. - - 1. Better landing page. - 2. Minor tweaks to the side bar. - 3. Reference to more example code. - 4. Local MathJax references. - - Change-Id: I39b9436dc2803732a875bbbee7f15802c4934031 - -commit 42a84b87fa5cc34551244a3b2b6a3e1f13a29514 -Author: Sameer Agarwal -Date: Fri Feb 1 12:22:53 2013 -0800 - - Expand reporting of timing information. - - 1. Add an ExecutionSummary object to record execution - information about Ceres objects. - 2. Add an EventLogger object to log events in a function call. - 3. Add a ScopedExecutionTimer object to log times in ExecutionSummary. - 4. Instrument ProgramEvaluator and all the linear solvers - to report their timing statistics. - 5. Connect the timing statistics to Summary::FullReport. - 6. Add high precision timer on unix systems using - gettimeofday() call. - 7. Various minor clean ups all around. - - Change-Id: I5e09804b730b09535484124be7dbc1c58eccd1d4 - -commit 08c891fcb6ea1bf66e6d4619273765a644605dfc -Author: Sameer Agarwal -Date: Mon Feb 4 20:18:58 2013 -0800 - - Various small changes. - - 1. Compact build instructions. - 2. Lots of small edits by Simon Fuhrmann. - - Change-Id: I8c0c67922021041dcf7f4ecdb6c6e6dd2e2fd7e5 - -commit e2e857ad6be322e9cf750d4b11ccf10800e57d96 -Author: Sameer Agarwal -Date: Mon Feb 4 19:40:45 2013 -0800 - - Sidebar has global table of contents. - - Change-Id: I7fe9053868a4660b0db8d7607ee618fc30ddaefd - -commit b9182147d96f865673c2756ced4cbb127ca082a3 -Author: Sameer Agarwal -Date: Mon Feb 4 17:55:25 2013 -0800 - - Change the theme to be closer to ReadTheDocs.org - - Change-Id: I61a76f5b5e5c292b54fdf51b66940ce80bd1cd5f - -commit 3d87b72c895835bbfc10965d50dc96608632114d -Author: Sameer Agarwal -Date: Sat Feb 2 00:49:31 2013 -0800 - - Convert documentation from LaTeX to Sphinx. - - A live version of the doc can be found at - - http://homes.cs.washington.edu/~sagarwal/ceres-solver/ - - As it stands, the documentation has better hyperlinking - and coverage than the latex documentation now. - - Change-Id: I7ede3aa83b9b9ef25104caf331e5727b4f5beae5 diff --git a/extern/libmv/third_party/ceres/include/ceres/cost_function_to_functor.h b/extern/libmv/third_party/ceres/include/ceres/cost_function_to_functor.h index b30ecd06983..fa1012de741 100644 --- a/extern/libmv/third_party/ceres/include/ceres/cost_function_to_functor.h +++ b/extern/libmv/third_party/ceres/include/ceres/cost_function_to_functor.h @@ -68,11 +68,11 @@ // new IntrinsicProjection(observation_))); // } // template -// bool operator(const T* rotation, -// const T* translation, -// const T* intrinsics, -// const T* point, -// T* residual) const { +// bool operator()(const T* rotation, +// const T* translation, +// const T* intrinsics, +// const T* point, +// T* residual) const { // T transformed_point[3]; // RotateAndTranslatePoint(rotation, translation, point, transformed_point); // diff --git a/extern/libmv/third_party/ceres/include/ceres/internal/autodiff.h b/extern/libmv/third_party/ceres/include/ceres/internal/autodiff.h index 011f2a05b65..2b32671c06d 100644 --- a/extern/libmv/third_party/ceres/include/ceres/internal/autodiff.h +++ b/extern/libmv/third_party/ceres/include/ceres/internal/autodiff.h @@ -38,7 +38,7 @@ // // struct F { // template -// bool operator(const T *x, const T *y, ..., T *z) { +// bool operator()(const T *x, const T *y, ..., T *z) { // // Compute z[] based on x[], y[], ... // // return true if computation succeeded, false otherwise. // } @@ -102,7 +102,7 @@ // // struct F { // template -// bool operator(const T *p, const T *q, T *z) { +// bool operator()(const T *p, const T *q, T *z) { // // ... // } // }; diff --git a/extern/libmv/third_party/ceres/include/ceres/numeric_diff_functor.h b/extern/libmv/third_party/ceres/include/ceres/numeric_diff_functor.h index 593c3718bf5..039e1a17aa7 100644 --- a/extern/libmv/third_party/ceres/include/ceres/numeric_diff_functor.h +++ b/extern/libmv/third_party/ceres/include/ceres/numeric_diff_functor.h @@ -71,11 +71,11 @@ // } // // template -// bool operator(const T* rotation, -// const T* translation, -// const T* intrinsics, -// const T* point, -// T* residuals) const { +// bool operator()(const T* rotation, +// const T* translation, +// const T* intrinsics, +// const T* point, +// T* residuals) const { // T transformed_point[3]; // RotateAndTranslatePoint(rotation, translation, point, transformed_point); // return (*intrinsic_projection_)(intrinsics, transformed_point, residual); diff --git a/extern/libmv/third_party/ceres/include/ceres/problem.h b/extern/libmv/third_party/ceres/include/ceres/problem.h index b1ccbab5dbd..0a449cb99f1 100644 --- a/extern/libmv/third_party/ceres/include/ceres/problem.h +++ b/extern/libmv/third_party/ceres/include/ceres/problem.h @@ -383,7 +383,7 @@ class Problem { // // Problem problem; // double x = 1; - // problem.Add(new MyCostFunction, NULL, &x); + // problem.AddResidualBlock(new MyCostFunction, NULL, &x); // // double cost = 0.0; // problem.Evaluate(Problem::EvaluateOptions(), &cost, NULL, NULL, NULL); diff --git a/extern/libmv/third_party/ceres/include/ceres/rotation.h b/extern/libmv/third_party/ceres/include/ceres/rotation.h index ffac4f1dc0c..ea0b76947eb 100644 --- a/extern/libmv/third_party/ceres/include/ceres/rotation.h +++ b/extern/libmv/third_party/ceres/include/ceres/rotation.h @@ -83,7 +83,7 @@ MatrixAdapter RowMajorAdapter3x3(T* pointer); // The implementation may be used with auto-differentiation up to the first // derivative, higher derivatives may have unexpected results near the origin. template -void AngleAxisToQuaternion(T const* angle_axis, T* quaternion); +void AngleAxisToQuaternion(const T* angle_axis, T* quaternion); // Convert a quaternion to the equivalent combined axis-angle representation. // The value quaternion must be a unit quaternion - it is not normalized first, @@ -92,13 +92,13 @@ void AngleAxisToQuaternion(T const* angle_axis, T* quaternion); // The implemention may be used with auto-differentiation up to the first // derivative, higher derivatives may have unexpected results near the origin. template -void QuaternionToAngleAxis(T const* quaternion, T* angle_axis); +void QuaternionToAngleAxis(const T* quaternion, T* angle_axis); // Conversions between 3x3 rotation matrix (in column major order) and // axis-angle rotation representations. Templated for use with // autodifferentiation. template -void RotationMatrixToAngleAxis(T const* R, T* angle_axis); +void RotationMatrixToAngleAxis(const T* R, T* angle_axis); template void RotationMatrixToAngleAxis( @@ -106,11 +106,11 @@ void RotationMatrixToAngleAxis( T* angle_axis); template -void AngleAxisToRotationMatrix(T const* angle_axis, T* R); +void AngleAxisToRotationMatrix(const T* angle_axis, T* R); template void AngleAxisToRotationMatrix( - T const* angle_axis, + const T* angle_axis, const MatrixAdapter& R); // Conversions between 3x3 rotation matrix (in row major order) and @@ -300,14 +300,14 @@ inline void QuaternionToAngleAxis(const T* quaternion, T* angle_axis) { // occurs and deals with them by taking code paths that are guaranteed // to not perform division by a small number. template -inline void RotationMatrixToAngleAxis(const T * R, T * angle_axis) { +inline void RotationMatrixToAngleAxis(const T* R, T* angle_axis) { RotationMatrixToAngleAxis(ColumnMajorAdapter3x3(R), angle_axis); } template void RotationMatrixToAngleAxis( const MatrixAdapter& R, - T * angle_axis) { + T* angle_axis) { // x = k * 2 * sin(theta), where k is the axis of rotation. angle_axis[0] = R(2, 1) - R(1, 2); angle_axis[1] = R(0, 2) - R(2, 0); @@ -385,13 +385,13 @@ void RotationMatrixToAngleAxis( } template -inline void AngleAxisToRotationMatrix(const T * angle_axis, T * R) { +inline void AngleAxisToRotationMatrix(const T* angle_axis, T* R) { AngleAxisToRotationMatrix(angle_axis, ColumnMajorAdapter3x3(R)); } template void AngleAxisToRotationMatrix( - const T * angle_axis, + const T* angle_axis, const MatrixAdapter& R) { static const T kOne = T(1.0); const T theta2 = DotProduct(angle_axis, angle_axis); diff --git a/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.cc b/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.cc index d0dc1e670c2..653194571b1 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.cc @@ -29,6 +29,8 @@ // Author: David Gallup (dgallup@google.com) // Sameer Agarwal (sameeragarwal@google.com) +#ifndef CERES_NO_SUITESPARSE + #include "ceres/canonical_views_clustering.h" #include "ceres/collections_port.h" @@ -236,3 +238,5 @@ void CanonicalViewsClustering::ComputeClusterMembership( } // namespace internal } // namespace ceres + +#endif // CERES_NO_SUITESPARSE diff --git a/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.h b/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.h index 5f8e4e3e5dd..48d1ed210c9 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.h +++ b/extern/libmv/third_party/ceres/internal/ceres/canonical_views_clustering.h @@ -41,6 +41,8 @@ #ifndef CERES_INTERNAL_CANONICAL_VIEWS_CLUSTERING_H_ #define CERES_INTERNAL_CANONICAL_VIEWS_CLUSTERING_H_ +#ifndef CERES_NO_SUITESPARSE + #include #include "ceres/collections_port.h" @@ -130,4 +132,5 @@ struct CanonicalViewsClusteringOptions { } // namespace internal } // namespace ceres +#endif // CERES_NO_SUITESPARSE #endif // CERES_INTERNAL_CANONICAL_VIEWS_CLUSTERING_H_ diff --git a/extern/libmv/third_party/ceres/internal/ceres/generate_eliminator_specialization.py b/extern/libmv/third_party/ceres/internal/ceres/generate_eliminator_specialization.py index 60953513f4f..caeca69fb80 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generate_eliminator_specialization.py +++ b/extern/libmv/third_party/ceres/internal/ceres/generate_eliminator_specialization.py @@ -65,8 +65,7 @@ SPECIALIZATIONS = [(2, 2, 2), (4, 4, 4), (4, 4, "Eigen::Dynamic"), ("Eigen::Dynamic", "Eigen::Dynamic", "Eigen::Dynamic")] - -SPECIALIZATION_FILE = """// Ceres Solver - A fast non-linear least squares minimizer +HEADER = """// Ceres Solver - A fast non-linear least squares minimizer // Copyright 2010, 2011, 2012, 2013 Google Inc. All rights reserved. // http://code.google.com/p/ceres-solver/ // @@ -105,8 +104,11 @@ SPECIALIZATION_FILE = """// Ceres Solver - A fast non-linear least squares minim // THIS FILE IS AUTOGENERATED. DO NOT EDIT. //========================================= // -// This file is generated using generate_eliminator_specializations.py. +// This file is generated using generate_eliminator_specialization.py. // Editing it manually is not recommended. +""" + +DYNAMIC_FILE = """ #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -118,22 +120,26 @@ template class SchurEliminator<%s, %s, %s>; } // namespace internal } // namespace ceres - """ -FACTORY_FILE_HEADER = """// Copyright 2011 Google Inc. All Rights Reserved. -// Author: sameeragarwal@google.com (Sameer Agarwal) -// -// ======================================== -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -// THIS FILE IS AUTOGENERATED. DO NOT EDIT. -//========================================= -// -// This file is generated using generate_template_specializations.py. -// Editing it manually is not recommended. +SPECIALIZATION_FILE = """ +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION +#include "ceres/schur_eliminator_impl.h" +#include "ceres/internal/eigen.h" + +namespace ceres { +namespace internal { + +template class SchurEliminator<%s, %s, %s>; + +} // namespace internal +} // namespace ceres + +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION +""" + +FACTORY_FILE_HEADER = """ #include "ceres/linear_solver.h" #include "ceres/schur_eliminator.h" #include "ceres/internal/eigen.h" @@ -184,6 +190,7 @@ def Specialize(): Generate specialization code and the conditionals to instantiate it. """ f = open("schur_eliminator.cc", "w") + f.write(HEADER) f.write(FACTORY_FILE_HEADER) for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS: @@ -192,9 +199,15 @@ def Specialize(): e_block_size, f_block_size) + ".cc" fptr = open(output, "w") - fptr.write(SPECIALIZATION_FILE % (row_block_size, - e_block_size, - f_block_size)) + fptr.write(HEADER) + + template = SPECIALIZATION_FILE + if (row_block_size == "Eigen::Dynamic" and + e_block_size == "Eigen::Dynamic" and + f_block_size == "Eigen::Dynamic"): + template = DYNAMIC_FILE + + fptr.write(template % (row_block_size, e_block_size, f_block_size)) fptr.close() f.write(FACTORY_CONDITIONAL % (row_block_size, diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_2.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_2.cc index b4a2cfd123c..7f9ce1431b9 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_2.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_2.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 2, 2>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_3.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_3.cc index 2373c6b86e1..d9ab1ddf2c1 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_3.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_3.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 2, 3>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_4.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_4.cc index 6253fe47410..a268810a829 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_4.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_4.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 2, 4>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_d.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_d.cc index d773a4f9d7e..46f9492e830 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_d.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_d.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 2, Eigen::Dynamic>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_3.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_3.cc index afb89b88891..ce53c6c07eb 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_3.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_3.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 3, 3>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_4.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_4.cc index c883ee690dc..7f6d41d7763 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_4.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_4.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 3, 4>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_9.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_9.cc index bdffdc5a98d..10f84afaaf0 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_9.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_9.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 3, 9>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_d.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_d.cc index 5d4139c23c3..047d473140a 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_d.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_d.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 3, Eigen::Dynamic>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_3.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_3.cc index 06b99df6622..12fdb861b34 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_3.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_3.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 4, 3>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_4.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_4.cc index 4bc1f44c2cd..0e29dc1781a 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_4.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_4.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 4, 4>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_d.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_d.cc index 573e40ca73f..4d4ac56537f 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_d.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_d.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<2, 4, Eigen::Dynamic>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_2.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_2.cc index e1f17fedd1b..4ad7d4162c0 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_2.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_2.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<4, 4, 2>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_3.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_3.cc index e7c750ade04..87f2fc58b58 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_3.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_3.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<4, 4, 3>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_4.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_4.cc index d60ad71eedd..8b3f5703b95 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_4.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_4.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<4, 4, 4>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_d.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_d.cc index 12fa9789beb..b21feb2d3b3 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_d.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_d.cc @@ -40,6 +40,8 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. +#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -51,3 +53,4 @@ template class SchurEliminator<4, 4, Eigen::Dynamic>; } // namespace internal } // namespace ceres +#endif // CERES_RESTRICT_SCHUR_SPECIALIZATION diff --git a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_d_d_d.cc b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_d_d_d.cc index fa34e39e42d..d483db7b578 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_d_d_d.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_d_d_d.cc @@ -40,6 +40,7 @@ // This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. + #include "ceres/schur_eliminator_impl.h" #include "ceres/internal/eigen.h" @@ -50,4 +51,3 @@ template class SchurEliminator; } // namespace internal } // namespace ceres - diff --git a/extern/libmv/third_party/ceres/internal/ceres/line_search.cc b/extern/libmv/third_party/ceres/internal/ceres/line_search.cc index e7508caec56..437f742607f 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/line_search.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/line_search.cc @@ -28,6 +28,7 @@ // // Author: sameeragarwal@google.com (Sameer Agarwal) +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER #include "ceres/line_search.h" #include @@ -209,3 +210,5 @@ void ArmijoLineSearch::Search(const LineSearch::Options& options, } // namespace internal } // namespace ceres + +#endif // CERES_NO_LINE_SEARCH_MINIMIZER diff --git a/extern/libmv/third_party/ceres/internal/ceres/line_search.h b/extern/libmv/third_party/ceres/internal/ceres/line_search.h index fccf63b598a..95bf56e2a6b 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/line_search.h +++ b/extern/libmv/third_party/ceres/internal/ceres/line_search.h @@ -33,6 +33,8 @@ #ifndef CERES_INTERNAL_LINE_SEARCH_H_ #define CERES_INTERNAL_LINE_SEARCH_H_ +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER + #include #include #include "ceres/internal/eigen.h" @@ -209,4 +211,5 @@ class ArmijoLineSearch : public LineSearch { } // namespace internal } // namespace ceres +#endif // CERES_NO_LINE_SEARCH_MINIMIZER #endif // CERES_INTERNAL_LINE_SEARCH_H_ diff --git a/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.cc b/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.cc index 1fc4de57e91..b8b582c3fb1 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.cc @@ -28,6 +28,8 @@ // // Author: sameeragarwal@google.com (Sameer Agarwal) +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER + #include "ceres/line_search_direction.h" #include "ceres/line_search_minimizer.h" #include "ceres/low_rank_inverse_hessian.h" @@ -143,3 +145,5 @@ LineSearchDirection::Create(const LineSearchDirection::Options& options) { } // namespace internal } // namespace ceres + +#endif // CERES_NO_LINE_SEARCH_MINIMIZER diff --git a/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.h b/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.h index 71063ab8414..08747544bbe 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.h +++ b/extern/libmv/third_party/ceres/internal/ceres/line_search_direction.h @@ -31,6 +31,8 @@ #ifndef CERES_INTERNAL_LINE_SEARCH_DIRECTION_H_ #define CERES_INTERNAL_LINE_SEARCH_DIRECTION_H_ +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER + #include "ceres/internal/eigen.h" #include "ceres/line_search_minimizer.h" #include "ceres/types.h" @@ -67,4 +69,5 @@ class LineSearchDirection { } // namespace internal } // namespace ceres +#endif // CERES_NO_LINE_SEARCH_MINIMIZER #endif // CERES_INTERNAL_LINE_SEARCH_DIRECTION_H_ diff --git a/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.cc b/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.cc index ca7d639c5ef..684a7369b3a 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.cc @@ -38,6 +38,8 @@ // For details on the theory and implementation see "Numerical // Optimization" by Nocedal & Wright. +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER + #include "ceres/line_search_minimizer.h" #include @@ -281,3 +283,5 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options, } // namespace internal } // namespace ceres + +#endif // CERES_NO_LINE_SEARCH_MINIMIZER diff --git a/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.h b/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.h index f82f13984a8..59f5c3fb9a4 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.h +++ b/extern/libmv/third_party/ceres/internal/ceres/line_search_minimizer.h @@ -31,6 +31,8 @@ #ifndef CERES_INTERNAL_LINE_SEARCH_MINIMIZER_H_ #define CERES_INTERNAL_LINE_SEARCH_MINIMIZER_H_ +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER + #include "ceres/minimizer.h" #include "ceres/solver.h" #include "ceres/types.h" @@ -74,4 +76,5 @@ class LineSearchMinimizer : public Minimizer { } // namespace internal } // namespace ceres +#endif // CERES_NO_LINE_SEARCH_MINIMIZER #endif // CERES_INTERNAL_LINE_SEARCH_MINIMIZER_H_ diff --git a/extern/libmv/third_party/ceres/internal/ceres/problem_impl.cc b/extern/libmv/third_party/ceres/internal/ceres/problem_impl.cc index 21d11442177..69d672ed9c6 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/problem_impl.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/problem_impl.cc @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -56,18 +57,28 @@ namespace internal { typedef map ParameterMap; +namespace { +internal::ParameterBlock* FindParameterBlockOrDie( + const ParameterMap& parameter_map, + double* parameter_block) { + ParameterMap::const_iterator it = parameter_map.find(parameter_block); + CHECK(it != parameter_map.end()) + << "Parameter block not found: " << parameter_block; + return it->second; +} + // Returns true if two regions of memory, a and b, with sizes size_a and size_b // respectively, overlap. -static bool RegionsAlias(const double* a, int size_a, - const double* b, int size_b) { +bool RegionsAlias(const double* a, int size_a, + const double* b, int size_b) { return (a < b) ? b < (a + size_a) : a < (b + size_b); } -static void CheckForNoAliasing(double* existing_block, - int existing_block_size, - double* new_block, - int new_block_size) { +void CheckForNoAliasing(double* existing_block, + int existing_block_size, + double* new_block, + int new_block_size) { CHECK(!RegionsAlias(existing_block, existing_block_size, new_block, new_block_size)) << "Aliasing detected between existing parameter block at memory " @@ -77,6 +88,8 @@ static void CheckForNoAliasing(double* existing_block, << "size " << new_block_size << "."; } +} // namespace + ParameterBlock* ProblemImpl::InternalAddParameterBlock(double* values, int size) { CHECK(values != NULL) << "Null pointer passed to AddParameterBlock " @@ -471,7 +484,8 @@ void ProblemImpl::RemoveResidualBlock(ResidualBlock* residual_block) { } void ProblemImpl::RemoveParameterBlock(double* values) { - ParameterBlock* parameter_block = FindOrDie(parameter_block_map_, values); + ParameterBlock* parameter_block = + FindParameterBlockOrDie(parameter_block_map_, values); if (options_.enable_fast_parameter_block_removal) { // Copy the dependent residuals from the parameter block because the set of @@ -503,17 +517,17 @@ void ProblemImpl::RemoveParameterBlock(double* values) { } void ProblemImpl::SetParameterBlockConstant(double* values) { - FindOrDie(parameter_block_map_, values)->SetConstant(); + FindParameterBlockOrDie(parameter_block_map_, values)->SetConstant(); } void ProblemImpl::SetParameterBlockVariable(double* values) { - FindOrDie(parameter_block_map_, values)->SetVarying(); + FindParameterBlockOrDie(parameter_block_map_, values)->SetVarying(); } void ProblemImpl::SetParameterization( double* values, LocalParameterization* local_parameterization) { - FindOrDie(parameter_block_map_, values) + FindParameterBlockOrDie(parameter_block_map_, values) ->SetParameterization(local_parameterization); } @@ -557,7 +571,8 @@ bool ProblemImpl::Evaluate(const Problem::EvaluateOptions& evaluate_options, parameter_blocks.resize(parameter_block_ptrs.size()); for (int i = 0; i < parameter_block_ptrs.size(); ++i) { parameter_blocks[i] = - FindOrDie(parameter_block_map_, parameter_block_ptrs[i]); + FindParameterBlockOrDie(parameter_block_map_, + parameter_block_ptrs[i]); } // 2. The user may have only supplied a subset of parameter diff --git a/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.cc b/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.cc index 17537596c75..e1be4e2a78a 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.cc @@ -141,6 +141,7 @@ bool DenseSchurComplementSolver::SolveReducedLinearSystem(double* solution) { return true; } +#if !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARE) SparseSchurComplementSolver::SparseSchurComplementSolver( const LinearSolver::Options& options) @@ -292,7 +293,7 @@ bool SparseSchurComplementSolver::SolveReducedLinearSystemUsingSuiteSparse( } if (VLOG_IS_ON(2)) { - cholmod_print_common("Symbolic Analysis", ss_.mutable_cc()); + cholmod_print_common(const_cast("Symbolic Analysis"), ss_.mutable_cc()); } } @@ -365,5 +366,6 @@ bool SparseSchurComplementSolver::SolveReducedLinearSystemUsingCXSparse( } #endif // CERES_NO_CXPARSE +#endif // !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARE) } // namespace internal } // namespace ceres diff --git a/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.h b/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.h index 7e98f316255..7c8d2e7ce38 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.h +++ b/extern/libmv/third_party/ceres/internal/ceres/schur_complement_solver.h @@ -151,7 +151,7 @@ class DenseSchurComplementSolver : public SchurComplementSolver { CERES_DISALLOW_COPY_AND_ASSIGN(DenseSchurComplementSolver); }; - +#if !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARE) // Sparse Cholesky factorization based solver. class SparseSchurComplementSolver : public SchurComplementSolver { public: @@ -182,6 +182,7 @@ class SparseSchurComplementSolver : public SchurComplementSolver { CERES_DISALLOW_COPY_AND_ASSIGN(SparseSchurComplementSolver); }; +#endif // !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARE) } // namespace internal } // namespace ceres diff --git a/extern/libmv/third_party/ceres/internal/ceres/schur_eliminator.cc b/extern/libmv/third_party/ceres/internal/ceres/schur_eliminator.cc index 8dbf30f0379..31f83547b5f 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/schur_eliminator.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/schur_eliminator.cc @@ -1,6 +1,35 @@ -// Copyright 2011 Google Inc. All Rights Reserved. +// Ceres Solver - A fast non-linear least squares minimizer +// Copyright 2010, 2011, 2012, 2013 Google Inc. All rights reserved. +// http://code.google.com/p/ceres-solver/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Google Inc. nor the names of its contributors may be +// used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// // Author: sameeragarwal@google.com (Sameer Agarwal) // +// Template specialization of SchurEliminator. +// // ======================================== // THIS FILE IS AUTOGENERATED. DO NOT EDIT. // THIS FILE IS AUTOGENERATED. DO NOT EDIT. @@ -8,7 +37,7 @@ // THIS FILE IS AUTOGENERATED. DO NOT EDIT. //========================================= // -// This file is generated using generate_template_specializations.py. +// This file is generated using generate_eliminator_specializations.py. // Editing it manually is not recommended. #include "ceres/linear_solver.h" diff --git a/extern/libmv/third_party/ceres/internal/ceres/solver_impl.cc b/extern/libmv/third_party/ceres/internal/ceres/solver_impl.cc index e18d3b96333..ffc347ec9f0 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/solver_impl.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/solver_impl.cc @@ -268,7 +268,7 @@ void SolverImpl::TrustRegionMinimize( WallTimeInSeconds() - minimizer_start_time; } - +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER void SolverImpl::LineSearchMinimize( const Solver::Options& options, Program* program, @@ -309,6 +309,7 @@ void SolverImpl::LineSearchMinimize( summary->minimizer_time_in_seconds = WallTimeInSeconds() - minimizer_start_time; } +#endif // CERES_NO_LINE_SEARCH_MINIMIZER void SolverImpl::Solve(const Solver::Options& options, ProblemImpl* problem_impl, @@ -316,7 +317,11 @@ void SolverImpl::Solve(const Solver::Options& options, if (options.minimizer_type == TRUST_REGION) { TrustRegionSolve(options, problem_impl, summary); } else { +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER LineSearchSolve(options, problem_impl, summary); +#else + LOG(FATAL) << "Ceres Solver was compiled with -DLINE_SEARCH_MINIMIZER=OFF"; +#endif } } @@ -608,6 +613,8 @@ void SolverImpl::TrustRegionSolve(const Solver::Options& original_options, event_logger.AddEvent("PostProcess"); } + +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER void SolverImpl::LineSearchSolve(const Solver::Options& original_options, ProblemImpl* original_problem_impl, Solver::Summary* summary) { @@ -661,7 +668,7 @@ void SolverImpl::LineSearchSolve(const Solver::Options& original_options, << "to single threaded mode."; options.num_threads = 1; } -#endif +#endif // CERES_USE_OPENMP summary->num_threads_given = original_options.num_threads; summary->num_threads_used = options.num_threads; @@ -800,7 +807,7 @@ void SolverImpl::LineSearchSolve(const Solver::Options& original_options, summary->postprocessor_time_in_seconds = WallTimeInSeconds() - post_process_start_time; } - +#endif // CERES_NO_LINE_SEARCH_MINIMIZER bool SolverImpl::IsOrderingValid(const Solver::Options& options, const ProblemImpl* problem_impl, diff --git a/extern/libmv/third_party/ceres/internal/ceres/solver_impl.h b/extern/libmv/third_party/ceres/internal/ceres/solver_impl.h index c5f5efad3d7..c05483021a4 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/solver_impl.h +++ b/extern/libmv/third_party/ceres/internal/ceres/solver_impl.h @@ -59,10 +59,29 @@ class SolverImpl { ProblemImpl* problem_impl, Solver::Summary* summary); + // Run the TrustRegionMinimizer for the given evaluator and configuration. + static void TrustRegionMinimize( + const Solver::Options &options, + Program* program, + CoordinateDescentMinimizer* inner_iteration_minimizer, + Evaluator* evaluator, + LinearSolver* linear_solver, + double* parameters, + Solver::Summary* summary); + +#ifndef CERES_NO_LINE_SEARCH_MINIMIZER static void LineSearchSolve(const Solver::Options& options, ProblemImpl* problem_impl, Solver::Summary* summary); + // Run the LineSearchMinimizer for the given evaluator and configuration. + static void LineSearchMinimize(const Solver::Options &options, + Program* program, + Evaluator* evaluator, + double* parameters, + Solver::Summary* summary); +#endif // CERES_NO_LINE_SEARCH_MINIMIZER + // Create the transformed Program, which has all the fixed blocks // and residuals eliminated, and in the case of automatic schur // ordering, has the E blocks first in the resulting program, with @@ -108,24 +127,6 @@ class SolverImpl { Program* program, string* error); - // Run the TrustRegionMinimizer for the given evaluator and configuration. - static void TrustRegionMinimize( - const Solver::Options &options, - Program* program, - CoordinateDescentMinimizer* inner_iteration_minimizer, - Evaluator* evaluator, - LinearSolver* linear_solver, - double* parameters, - Solver::Summary* summary); - - // Run the LineSearchMinimizer for the given evaluator and configuration. - static void LineSearchMinimize( - const Solver::Options &options, - Program* program, - Evaluator* evaluator, - double* parameters, - Solver::Summary* summary); - // Remove the fixed or unused parameter blocks and residuals // depending only on fixed parameters from the problem. Also updates // num_eliminate_blocks, since removed parameters changes the point diff --git a/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.cc b/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.cc index dd05f0c6f41..195cacb984c 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.cc @@ -28,6 +28,8 @@ // // Author: sameeragarwal@google.com (Sameer Agarwal) +#if !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARSE) + #include "ceres/sparse_normal_cholesky_solver.h" #include @@ -213,7 +215,7 @@ LinearSolver::Summary SparseNormalCholeskySolver::SolveImplUsingSuiteSparse( } if (VLOG_IS_ON(2)) { - cholmod_print_common("Symbolic Analysis", ss_.mutable_cc()); + cholmod_print_common(const_cast("Symbolic Analysis"), ss_.mutable_cc()); } } @@ -257,3 +259,5 @@ LinearSolver::Summary SparseNormalCholeskySolver::SolveImplUsingSuiteSparse( } // namespace internal } // namespace ceres + +#endif // !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARSE) diff --git a/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.h b/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.h index 8d48096d4c6..ebb32e61939 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.h +++ b/extern/libmv/third_party/ceres/internal/ceres/sparse_normal_cholesky_solver.h @@ -34,6 +34,8 @@ #ifndef CERES_INTERNAL_SPARSE_NORMAL_CHOLESKY_SOLVER_H_ #define CERES_INTERNAL_SPARSE_NORMAL_CHOLESKY_SOLVER_H_ +#if !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARSE) + #include "ceres/cxsparse.h" #include "ceres/internal/macros.h" #include "ceres/linear_solver.h" @@ -90,4 +92,5 @@ class SparseNormalCholeskySolver : public CompressedRowSparseMatrixSolver { } // namespace internal } // namespace ceres +#endif // !defined(CERES_NO_SUITESPARSE) || !defined(CERES_NO_CXSPARSE) #endif // CERES_INTERNAL_SPARSE_NORMAL_CHOLESKY_SOLVER_H_ diff --git a/extern/libmv/third_party/ceres/internal/ceres/visibility.cc b/extern/libmv/third_party/ceres/internal/ceres/visibility.cc index 371bdfacd52..fcd793c00a8 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/visibility.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/visibility.cc @@ -28,6 +28,8 @@ // // Author: kushalav@google.com (Avanish Kushal) +#ifndef CERES_NO_SUITESPARSE + #include "ceres/visibility.h" #include @@ -150,3 +152,5 @@ Graph* CreateSchurComplementGraph(const vector >& visibility) { } // namespace internal } // namespace ceres + +#endif diff --git a/extern/libmv/third_party/ceres/internal/ceres/visibility.h b/extern/libmv/third_party/ceres/internal/ceres/visibility.h index f29e3c6a0a8..2d1e6f85ddf 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/visibility.h +++ b/extern/libmv/third_party/ceres/internal/ceres/visibility.h @@ -35,6 +35,8 @@ #ifndef CERES_INTERNAL_VISIBILITY_H_ #define CERES_INTERNAL_VISIBILITY_H_ +#ifndef CERES_NO_SUITESPARSE + #include #include #include "ceres/graph.h" @@ -74,4 +76,5 @@ Graph* CreateSchurComplementGraph(const vector >& visibility); } // namespace internal } // namespace ceres +#endif // CERES_NO_SUITESPARSE #endif // CERES_INTERNAL_VISIBILITY_H_ diff --git a/extern/libmv/third_party/ceres/internal/ceres/visibility_based_preconditioner.cc b/extern/libmv/third_party/ceres/internal/ceres/visibility_based_preconditioner.cc index a75d6f0c17e..1678d0072e5 100644 --- a/extern/libmv/third_party/ceres/internal/ceres/visibility_based_preconditioner.cc +++ b/extern/libmv/third_party/ceres/internal/ceres/visibility_based_preconditioner.cc @@ -28,6 +28,8 @@ // // Author: sameeragarwal@google.com (Sameer Agarwal) +#ifndef CERES_NO_SUITESPARSE + #include "ceres/visibility_based_preconditioner.h" #include @@ -62,7 +64,6 @@ namespace internal { static const double kSizePenaltyWeight = 3.0; static const double kSimilarityPenaltyWeight = 0.0; -#ifndef CERES_NO_SUITESPARSE VisibilityBasedPreconditioner::VisibilityBasedPreconditioner( const CompressedRowBlockStructure& bs, const Preconditioner::Options& options) @@ -427,7 +428,7 @@ bool VisibilityBasedPreconditioner::Factorize() { } if (VLOG_IS_ON(2)) { - cholmod_print_common("Symbolic Analysis", ss_.mutable_cc()); + cholmod_print_common(const_cast("Symbolic Analysis"), ss_.mutable_cc()); } } @@ -584,7 +585,7 @@ void VisibilityBasedPreconditioner::FlattenMembershipMap( } } -#endif // CERES_NO_SUITESPARSE - } // namespace internal } // namespace ceres + +#endif // CERES_NO_SUITESPARSE -- cgit v1.2.3