Commit Graph

990 Commits

Author SHA1 Message Date
Sameer Agarwal 5f2f05c726 Refactor system_test
1. Move common test infrastructure into test_util.
2. system_test now only contains powells function.
3. Add bundle_adjustment_test.

Instead of a single function which computes everything,
there is now a test for each solver configuration which
uses the reference solution computed by the fixture.

Change-Id: I16a9a9a83a845a7aaf28762bcecf1a8ff5aee805
2015-09-12 15:41:05 -07:00
Alex Stewart 1936d47e21 Revert increased inline threshold (iff Clang) to exported Ceres target.
- Increasing the inline threshold results in very variable performance
  improvements, and could potentially confuse users if they are trying
  to set the inline threshold themselves.
- As such, we no longer export our inline threshold configuration for
  Clang, but instead document how to change it in the FAQs.

Change-Id: I88e2e0001e4586ba2718535845ed1e4b1a5b72bc
1.11.0rc2
2015-09-08 23:27:42 +01:00
Sameer Agarwal a66d89dcda Get ready for 1.11.0RC1
Update version numbers.
Drop CERES_VERSION_ABI macro.

Change-Id: Ib3eadabb318afe206bb196a5221b195d26cbeaa0
2015-09-08 14:55:28 -07:00
Sameer Agarwal 1ac3dd223c Fix a bug in CompressedRowSparseMatrix::AppendRows
The test for CompressedRowSparseMatrix::AppendRows tries to add
a matrix of size zero, which results in an invalid pointer deferencing
even though that pointer is never written to.

Change-Id: I97dba37082bd5dad242ae1af0447a9178cd92027
2015-09-05 15:56:14 -07:00
Sameer Agarwal 67622b080c Fix a pointer access bug in Ridders' algorithm.
A pointer to an Eigen matrix was being used as an array.

Change-Id: Ifaea14fa3416eda5953de49afb78dc5a6ea816eb
2015-09-05 21:37:22 +00:00
Sameer Agarwal 5742b7d0f1 Improve performance of SPARSE_NORMAL_CHOLESKY + dynamic_sparsity
The outer product computation logic in SparseNormalCholeskySolver
does not work well with dynamic sparsity. The overhead of computing
the sparsity pattern of the normal equations is only amortized if
the sparsity is constant. If the sparsity can change from call to call
SparseNormalCholeskySolver will actually be more expensive.

For Eigen and for CXSparse we now explicitly compute the normal
equations using their respective matrix-matrix product routines and solve.
Change-Id: Ifbd8ed78987cdf71640e66ed69500442526a23d4
2015-09-05 14:31:52 -07:00
Keir Mierle d0b6cf657d Fix incorrect detect structure test
Change-Id: I7062f3639147c40b57947790d3b18331a39a366b
2015-09-04 18:43:41 -07:00
Alex Stewart 0e8264cc47 Add increased inline threshold (iff Clang) to exported Ceres target.
- When compiled with Clang, Ceres and all of the examples are compiled
  with an increased inlining-threshold, as the default value can result
  in poor Eigen performance.
- Previously, client code using Ceres would typically not use an
  increased inlining-threshold (unless the user has specifically added
  it themselves).  However, increasing the inlining threshold can result
  in significant performance improvements in auto-diffed CostFunctions.
- This patch adds the inlining-threshold flags to the interface flags
  for the Ceres CMake target s/t any client code using Ceres (via
  CMake), and compiled with Clang, will now be compiled with the same
  increased inlining threshold as used by Ceres itself.

Change-Id: I31e8f1abfda140d22e85bb48aa57f028a68a415e
2015-09-02 19:37:01 +01:00
Alex Stewart a1b3fce9e0 Add optional export of Ceres build directory to new features list.
Change-Id: I6f1e42b41957ae9cc98fd9dcd1969ef64c4cd96f
2015-08-31 14:14:56 +01:00
Alex Stewart e46777d8df Credit reporters of buildsystem bugs in version history.
Change-Id: I16fe7973534cd556d97215e84268ae0b8ec4e11a
2015-08-31 12:41:54 +01:00
Sameer Agarwal 01548282cb Update the version history.
Change-Id: I29873bed31675e0108f1a44f53f7bc68976b7f98
2015-08-30 22:34:04 -07:00
Sameer Agarwal 2701429f77 Use Eigen::Dynamic instead of ceres::DYNAMIC in numeric_diff.h
Change-Id: Iccb0284a8fb4c2160748dfae24bcd595f1d4cb5c
2015-08-30 21:33:57 -07:00
Tal Ben-Nun 4f049db7c2 Adaptive numeric differentiation using Ridders' method.
This method numerically computes function derivatives in different
scales, extrapolating between intermediate results to conserve function
evaluations. Adaptive differentiation is essential to produce accurate
results for functions with noisy derivatives.

Full changelist:
-Created a new type of NumericDiffMethod (RIDDERS).
-Implemented EvaluateRiddersJacobianColumn in NumericDiff.
-Created unit tests with f(x) = x^2 + [random noise] and
 f(x) = exp(x).

Change-Id: I2d6e924d7ff686650272f29a8c981351e6f72091
2015-08-30 14:06:13 +03:00
Sameer Agarwal 070bba4b43 Lint fixes from William Rucklidge
Change-Id: I719e8852859c970091df842e59c44e02e2c65827
2015-08-25 13:37:33 -07:00
Alex Stewart 887a20ca7f Build position independent code when compiling Ceres statically.
- Previously, when Ceres was built as a static library we did not
  compile position independent code.  This means that the resulting
  static library could not be linked against shared libraries, but
  could be used by executables.
- To enable the use of a static Ceres library by other shared libraries
  as reported in [1], the static library must be generated from
  position independent code (except on Windows, where PIC does not
  apply).

[1] https://github.com/Itseez/opencv_contrib/pull/290#issuecomment-130389471

Change-Id: I99388f1784ece688f91b162d009578c5c97ddaf6
2015-08-25 18:29:08 +00:00
Sameer Agarwal 860bba588b Fix a bug in DetectStructure
The logic for determing static/dynamic f-block size in
DetectStructure was broken in a corner case, where the very first
row block which was used to initialize the f_block_size contained
more than one f blocks of varying sizes. The way the if block
was structured, no iteration was performed on the remaining
f-blocks and the loop failed to detect that the f-block size
was actually changing.

If in the remaining row blocks, there were no row blocks
with varying f-block sizes, the function will erroneously
return a static f-block size.

Thanks to Johannes Schonberger for providing a reproduction for this
rather tricky corner case.

Change-Id: Ib442a041d8b7efd29f9653be6a11a69d0eccd1ec
2015-08-25 11:14:10 -07:00
Johannes Schönberger b0cbc0f0b0 Reduce memory footprint of SubsetParameterization
Change-Id: If113cb4696d5aef3e50eed01fba7a3d4143b7ec8
2015-08-22 16:15:26 +00:00
Sergey Sharybin ad2a997777 Fix for reoder program unit test when built without suitesparse
This commit fixes failure of reorder_program_test when Ceres is built without
any suitesparse.

Change-Id: Ia23ae8dfd20c482cb9cd1301f17edf9a34df3235
2015-08-22 11:18:45 +02:00
Sameer Agarwal 4bf3868bec Fix a bug in the Schur eliminator
The schur eliminator treats rows with e blocks and row with
no e blocks separately. The template specialization logic only
applies to the rows with e blocks.

So, in cases where the rows with e-blocks have a fixed size f-block
but the rows without e-blocks have f-blocks of varying sizes,
DetectStructure will return a static f-block size, but we need to be
careful that we do not blindly use that static f-block size everywhere.

This patch fixes a bug where such care was not being taken, where
it was assumed that the static f-block size could be assumed for all
f-block sizes.

A new test is added, which triggers an exception in debug mode. In
release mode this error does not present itself, due to a peculiarity
of the way Eigen works.

Thanks to Werner Trobin for reporting this bug.

Change-Id: I8ae7aabf8eed8c3f9cf74b6c74d632ba44f82581
2015-08-20 23:34:26 -07:00
Sameer Agarwal 1635ce7260 Fix a bug in the reordering code.
When the user provides an ordering which starts at a non-zero group id,
or has gaps in the groups, then CAMD, the algorithm used to reorder
the program can crash or return garbage results.

The solution is to map the ordering into grouping constraints, and then
to re-number the groups to be contiguous using a call to
MapValuesToContiguousRange. This was already done for CAMD based
ordering for Schur type solvers, but was not done for SPARSE_NORMAL_CHOLESKY.

Thanks to Bernhard Zeisl for not only reporting the bug but also
providing a reproduction.

Change-Id: I5cfae222d701dfdb8e1bda7f0b4670a30417aa89
2015-08-19 22:36:51 +00:00
Simon Rutishauser 4c3f8987e7 Add missing CERES_EXPORT to ComposedLoss
Change-Id: Id7db388d41bf53e6e5704039040c9d2c6bf4c29c
2015-08-13 11:10:44 +02:00
Sameer Agarwal 1a740cc787 Add the option to use numeric differentiation to nist and more_garbow_hillstrom
Change-Id: If0a5caef90b524dcf5e2567c5b681987f5459401
2015-08-11 20:16:12 -07:00
Alex Stewart ea667ede5c Fix EIGENSPARSE option help s/t it displays in CMake ncurses GUI.
- Shorten description for EIGENSPARSE to a single line, as otherwise
  it is not correctly displayed in the ncurses CMake GUI.
- Made explicit in description that this results in an LGPL licensed
  version of Ceres (this is also made clear in the CMake log output if
  EIGENSPARSE is enabled).

Change-Id: I11678a9cbc7a817133c22128da01055a3cb8a26d
2015-08-11 16:24:22 +00:00
Richard Stebbing a14ec27fb2 Fix SparseNormalCholeskySolver with dynamic sparsity.
The previous implementation incorrectly cached the outer product matrix
pattern even when `dynamic_sparsity = true`.

Change-Id: I1e58315a9b44f2f457d07c56b203ab2668bfb8a2
2015-08-09 23:07:39 +00:00
Alex Stewart 3dd7fced44 Remove legacy dependency detection macros.
- Before the new CMake buildsystem in 1.8, Ceres used non-standard
  HINTS variables for dependencies.  For backwards compatibility CMake
  macros were added to translate these legacy variables into the new
  (standard) variables.
- As it has now been multiple releases since the legacy variables
  were used and they no longer appear in any of the documentation
  support for them has now expired.

Change-Id: I2cc72927ed711142ba7943df334ee008181f86a2
2015-08-09 16:38:50 +01:00
Alex Stewart 8b32e258cc Fix failed if() condition expansion if gflags is not found.
- If a CMake-ified version of gflags is not detected, then
  gflags_LIBRARIES is not set and the TARGET condition within a
  multiconditional if() statement prevents configuration.

Change-Id: Ia92e97523d7a1478ab36539726b9540d7cfee5d0
2015-08-09 15:42:39 +01:00
Alex Stewart cc8d47aabb Update all CMake to lowercase function name style.
- Updated to new CMake style where function names are all lowercase,
  this will be backwards compatible as CMake function names are
  case insensitive.
- Updated using Emacs' M-x unscreamify-cmake-buffer.

Change-Id: If7219816f560270e59212813aeb021353a64a0e2
2015-08-09 15:18:42 +01:00
Alex Stewart 1f106904c1 Update minimum iOS version to 7.0 for shared_ptr/unordered_map.
- In order to correctly detect shared_ptr (& unordered_map)
  the iOS version must be >= 7.0 (Xcode 5.0+).  This only affects the
  SIMULATOR(64) platform builds, as the OS (device) build uses the
  latest SDK which is now likely 8.0+.

Change-Id: Iefec8f03408b8cdc7a495f442ebba081f800adb0
2015-08-09 14:55:02 +01:00
Alex Stewart 16ecd40523 Fix bug in gflags' <= 2.1.2 exported CMake configuration.
- gflags <= 2.1.2 has a bug in its exported gflags-config.cmake:
  https://github.com/gflags/gflags/issues/110 whereby it sets
  gflags_LIBRARIES to a non-existent 'gflags' target.
- This causes linker errors if gflags is installed in a non-standard
  location (as otherwise CMake resolves gflags to -lgflags which
  links if gflags is installed somewhere on the current path).
- We now check for this case, and search for the correct gflags imported
  target and update gflags_LIBRARIES to reference it if found, otherwise
  proceed on to the original manual search to try to find gflags.

Change-Id: Iceccc3ee53c7c2010e41cc45255f966e7b13d526
2015-08-08 17:32:31 +01:00
Alex Stewart 56be8de007 Add docs for new CXX11 option & mask option for Windows.
- The CXX11 option has no effect on Windows, as there, any new C++11
  features are enabled by default, as such to avoid confusion we only
  present the option for non-Windows.

Change-Id: I38925ae3bb8c16682d404468ba95c611a519b9b9
2015-08-07 20:15:34 +01:00
Sameer Agarwal cf863b6415 Remove the spec file needed for generating RPMs.
Now that ceres is part of RawHide, there is no need to carry
this spec file with the ceres distribution.

Change-Id: Icc400b9874ba05ba05b353e2658f1de94c72299e
2015-08-06 23:27:39 +00:00
Sameer Agarwal 560940fa27 A refactor of the cubic interpolation code
1. Push the boundary handling logic into the underlying array
object. This has two very significant impacts:

a. The interpolation code becomes extremely simple to write
and to test.

b. The user has more flexibility in implementing how out of bounds
values are handled. We provide one default implementation.

Change-Id: Ic2f6cf9257ce7110c62e492688e5a6c8be1e7df2
2015-08-06 14:49:55 -07:00
Sameer Agarwal dfdf19e111 Lint cleanup from Jim Roseborough
Change-Id: Id6845c85644d40e635ed196ca74fc51a387aade4
2015-08-05 15:20:57 -07:00
Sameer Agarwal 7444f23ae2 Fix a typo in small_blas.h
The reason this rather serious looking typo has not
caused any problems uptil now is because NUM_ROW_B is
computed but never actually used.

Thanks to Werner Trobin for pointing this out.

Change-Id: Id2b4d9326ec21baec8a85423e3270aefbafb611e
2015-08-03 12:24:25 -07:00
Alex Stewart 5a48b92123 Export Ceres build directory into local CMake package registry.
- Optionally use CMake's export() functionality to export the Ceres
  build directory as a package into the local CMake package registry.
- This enables the detection & use of Ceres from CMake *without*
  requiring that Ceres be installed.

Change-Id: Ib5a7588446f490e1b405878475b6b1dd13accd1f
2015-08-03 16:46:05 +00:00
Sameer Agarwal d9790e7789 Add ProductParameterization
Often a parameter block is the Cartesian product of a number of
manifolds. For example, a rigid transformation SE(3) = SO(3) x R^3
In such cases, where you have the local parameterization
of the individual manifolds available,
ProductParameterization can be used to construct a local
parameterization of the cartesian product.

Change-Id: I4b5bcbd2407a38739c7725b129789db5c3d65a20
2015-07-27 13:37:10 -07:00
Alex Stewart 7b4fb69dad Cleanup FindGflags & use installed gflags CMake config if present.
- Split out gflags namespace detection methods:
  check_cxx_source_compiles() & regex, into separate functions.
- Use installed/exported gflags CMake configuration (present for
  versions >= 2.1) if available, unless user expresses a preference not
  to, or specifies search directories, in which case fall back to manual
  search for components.
-- Prefer installed gflags CMake configurations over exported gflags
   build directories on all OSs.
- Remove custom version of check_cxx_source_compiles() that attempted
  to force the build type of the test project.  This only worked for
  NMake on Windows, not MSVC as msbuild ignored our attempts to force
  the build type.  Now we always use the regex method on Windows if
  we cannot find an installed gflags CMake configuration which works
  even on MSVC by bypassing msbuild.
- Add default search paths for gflags on Windows.

Change-Id: I083b267d97a7a5838a1314f3d41a61ae48d5a2d7
2015-07-15 22:12:44 +00:00
Alex Stewart b3063c0479 Add default glog install location on Windows to search paths.
Change-Id: I083d368be48986e6780c11460f5a07b2f3b6c900
2015-07-15 20:56:56 +01:00
Alex Stewart 4e84d86dcb Add default Eigen install location on Windows to search paths.
Change-Id: If2e9999b04550269c94a86b8512d9dcc2842b91d
2015-07-15 19:07:52 +00:00
Alex Stewart e9420e7a0e Fix explanation of config.h generation in bare config.h.
Change-Id: I66488dc09670c4b178db7a3ae21b93fcc84ca051
2015-07-12 19:26:59 +01:00
Alex Stewart c80ce3525d Fix unused parameter compiler warnings in numeric_diff.h
Change-Id: I2b35babba17229387c6d346c46a2c6960db96e47
2015-07-11 18:27:00 +01:00
Sameer Agarwal cbdecc588a Actually fix the rawhide tolerance bug.
And undo the last two botched CLs.

Thanks to Chris Sweeney and Taylor Braun Jones for saving my bacon.
I will do appropriate penance to repend for my sins.

Change-Id: I14de958e651f85e4c1741fba2cb46ffe7e873346
2015-07-09 21:20:40 -07:00
Sameer Agarwal 3efa55c60f Fix the build
The last patch introduced a typo in the test.

Thanks to Chris Sweeney for pointing this out.

Change-Id: I1de2dba895de2d40f20d661524b57b821fb2d443
2015-07-08 14:44:58 -07:00
Sameer Agarwal 368fa5dc8f Increase tolerance for a test in polynomial_test
This test is failing on RawHide due to some compiler
changes.

https://bugzilla.redhat.com/attachment.cgi?id=1046512

Change-Id: I242314a3804b2888f06e5df0a0ea5d3bf057d5df
2015-07-08 12:32:59 -07:00
Alex Stewart b0696f6269 Fix addition of Gerrit commit hook when Ceres is a git submodule.
- Also split out addition of Gerrit commit hook into its own function.

Change-Id: I28ed048c5a094c5c9c0246cdabf67833583d66fb
2015-07-06 20:12:49 +01:00
Alex Stewart 29aff99b6f Fix missing EIGEN_VERSION expansion typo.
Change-Id: I1f481f5cb618f1c4dfe48e2bf4607f7801f65991
2015-07-02 09:27:20 +01:00
Alex Stewart bae78c88c7 Fix links to SuiteSparse & CXSparse.
- Thanks to Henrique Mendonça for reporting this.

Change-Id: I590f6138177b2e608eca9726f556d2f92d00d4d7
2015-06-28 14:02:10 +01:00
Alex Stewart b7e9a5762b Ensure Eigen is at least 3.1.0 for Eigen/SparseCore.
- Eigen/SparseCore is required by covariance_impl, this was added in
  v 3.1.0 of Eigen, and thus without at least this version Ceres will
  not compile.
- Note that Ubuntu 12.04 provides only version 3.0.5 in the mainline
  repository.
- Update docs to match CMake check for Eigen >= 3.2.2 to avoid warning
  about reduced sparse performance.

Change-Id: I291bb185d1c76e1e1422429169a76e3f1b828163
2015-06-27 16:03:41 +00:00
Alex Stewart 6414bd0279 Add option to use C++11 (not TR1) shared_ptr & unordered_map.
- On at least some compilers, -std=c++11 is required in order to compile
  against std::shared_ptr & std::unordered_map, which resulted in our
  checks failing to find them and using the TR1 versions instead, which
  causes conflicts for users using C++11.
- Now, if the compiler supports it and the user enables the CXX11
  option, we explicitly enable C++11 before searching for shared_ptr &
  unordered_map, which means we should always find the C++11 versions
  if they are available.
- As use of CXX11 results in a version of Ceres that must be used with
  -std=c++11 for GCC & Clang, we roll this into the Ceres target when
  the version of CMake supports this, otherwise we warn the user they
  will have to do this themselves.
- CXX11 is OFF by default, to ensure that the behaviour of Ceres is
  unchanged from before.

Change-Id: I157ea7a4fadc6bc02da176b8e771f1f327ccaf78
2015-06-22 08:54:40 +00:00
David Gossow 2a1dfd2b71 Add DynamicCostFunctionToFunctor.
This adds a new wrapper class called DynamicCostFunctionToFunctor
that closes a gap in the current API: the existing
CostFunctionToFunctor can only be used with a SizedCostFunction, where
the number and sizes of all parameter vectors are known at compile-time.
The DynamicCostFunctionToFunctor allows you to wrap a generic
CostFunction into a templated functor which can then be used in a
DynamicAutoDiffCostFunction.

Also updates the existing CostFunctionToFunctor class to internally use
DynamicCostFunctionToFunctor.

Change-Id: I088adc3271c58d2519126c27037c3576965a36d6
2015-06-18 16:01:15 -07:00