Commit Graph

1093 Commits

Author SHA1 Message Date
Alex Stewart b4e27240b2 Use default alignment if alignof(std::max_align_t) < 16 with C++11.
- As per Andrew Hunter’s comments in the commit which added Jet
  alignment when using C++11 here:
  https://ceres-solver-review.googlesource.com/#/c/7100, there is wide
  lattitude in the standard about what the maximum supported alignment
  can be.
- Previously, we were forcing the alignment to 1, if the value of
  alignof(std::max_align_t), which we use as a proxy for the maximum
  supported alignment on the platform, was < 16.
- An alignment of 1 is not valid for Jets, as it would weaken the
  natural alignment of the types within a Jet, which would typically be
  4 (32-bit systems) or 8 (64-bit systems), thus resulting in a compiler
  error.
- This was reported as issue 235 for Clang 3.8 on i386:
  https://github.com/ceres-solver/ceres-solver/issues/235.

Change-Id: Ie39e5499c64f9231f29ebf4392992b5c9ce2e385
2016-11-12 17:18:25 +00:00
Sameer Agarwal 717417512b Update changelog
Change-Id: I1c8bef059adc57476b5e75310fd7d983b8229bf7
1.12.0rc2
2016-11-11 10:48:51 -08:00
Sameer Agarwal 78abf0cdfe Introduce a common base class for DynamicAutoDiffCostFunction and DynamicNumericDiffCostFunction.
In the process also move some documentation from the file header to
just above the class declaration.

This change is in response to https://github.com/ceres-solver/ceres-solver/issues/233

Change-Id: I08cff1a94c57b67dd2bd8be4dba8c3fce46b68ab
2016-11-11 07:35:22 -08:00
Sameer Agarwal 88b827a0e7 Fix an exact equality test causing breakage in gradient_checker_test.
Also clang-format the file to fix some accumulated cruft.

Change-Id: Icf41e3f864a4fe925426477893602b50ff2131f4
2016-11-01 07:42:56 -07:00
Sameer Agarwal f21c17064b Add GradientProblemSolver::Options::parameter_tolerance.
Support for parameter tolerance was added to the line search
minimizer was added a while ago, and calling Solve on a
non-linear least squares problem supported it but for some reason
the GradientProblemSolver::Options struct was missing this
option even though the documentation suggested that it was present!

Thanks to Noah Snavely for reporting this bug.

Change-Id: I57cf4ab396bc822c19fa298529e113b89664a349
2016-11-01 12:56:19 +00:00
Rob Carroll e69bd2a206 Add missing T() wrappers for constants.
Needed for instantiation with Jet<float,N>.

Change-Id: I8ec07a844cc911a3c7f24c25797bd21c0bee07b5
2016-10-31 12:51:44 -07:00
Sameer Agarwal 8590e6e8e0 Remove two checks from rotation.h
This allows rotation.h to remove its dependency on glog.

Change-Id: Ia6aede93ee51a4bd4039570dc8edd100a7045329
2016-10-27 12:36:13 -07:00
Je Hyeong Hong e892499e8d Relax the tolerance in QuaternionParameterizationTestHelper.
This commit relaxes the tolerance value for comparing between the actual
local matrix and the expected local matrix. Without this fix,
EigenQuaternionParameterization.ZeroTest could fail as the difference
exactly matches the value of std::numeric_limits<double>::epsilon().

Change-Id: Ic4d3f26c0acdf5f16fead80dfdc53df9e7dabbf9
2016-10-20 00:16:18 +01:00
Sameer Agarwal 7ed9e2fb7f Occured -> Occurred.
Thanks to Phillip Huebner for reporting this.

Change-Id: I9cddfbb373aeb496961d08e434fe661bff4abd29
2016-10-19 04:45:23 -07:00
Je Hyeong Hong b82f972796 Fix a test error in autodiff_test.cc.
Previously, the test for the projective camera model would fail as no
tolerance is set in line 144. To resolve this, this commit changes
assert_equal to assert_near.

Change-Id: I6cd3379083b1a10c7cd0a9cc83fd6962bb993cc9
2016-10-18 21:49:26 +01:00
Sameer Agarwal 5690b447de Fix documentation source for templated functions in rotation.h
Change-Id: Ic1b2e6f0e6eb9914f419fd0bb5af77b66252e57c
1.12.0rc1
2016-10-13 09:52:02 -07:00
Sameer Agarwal 2f8f98f7e8 Prepare for 1.12.0RC1
Change-Id: I23eaf0b46117a01440143001b74dacfa5e57cbf0
2016-10-13 09:35:18 -07:00
Damon Kohler 55c12d2e95 Adds package.xml to support Catkin.
Change-Id: I8ad4d36a8b036417604a54644e0bb70dd1615feb
2016-10-11 06:32:26 +00:00
Sameer Agarwal 0bcce65652 Fix tabs in Android.mk
Change-Id: Ie5ab9a8ba2b727721565e1ded242609b6df5f8f5
2016-10-10 23:30:42 -07:00
Sameer Agarwal e6ffe26671 Update the version history.
Change-Id: I9a57b0541d6cebcb695ecb364a1d4ca04ea4e06c
2016-10-10 22:47:08 -07:00
David Gossow 0a4ccb7ee9 Relaxing Jacobian matching in Gradient Checker test.
Any result of an arithmetic operation on floating-point matrices
should never be checked for strict equality with some expected
value, due to limited floating point precision on different machines.
This fixes some occurences of exact checks in the gradient checker
unit test that were causing problems on some platforms.

Change-Id: I48e804c9c705dc485ce74ddfe51037d4957c8fcb
2016-10-10 14:40:14 +00:00
Je Hyeong Hong ee44fc91b5 Fix an Intel compiler error in covariance_impl.cc.
Intel C compiler strictly asks for parallel loops with collapse to be
perfectly nested. Otherwise, compiling Ceres with ICC will throw an
error at line 348 of covariance_impl.cc.

Change-Id: I1ecb68e89b7faf79e4153dfe6675c390d1780db4
2016-10-03 14:13:19 +01:00
Sameer Agarwal 9026d69d1c Allow SubsetParameterization to hold all parameters constant
1. SubsetParameterization can now be constructed such that all
parameters are constant. This is required for it be used as part
of a ProductParameterization to hold a part of parameter block
constant. For example, a parameter block consisting of a rotation
as a quaternion and a translation vector can now have a local
parameterization where the translation part is constant and the
quaternion part has a QuaternionParameterization associated with it.

2. The check for the tangent space of a parameterization being
positive dimensional. We were not doing this check up till now
and the user could accidentally create parameterizations like this
and create a problem for themselves. This will ensure that even
though one can construct a SubsetParameterization where all
parameters are constant, you cannot actually use it as a local
parameterization for an entire parameter block. Which is how
it was before, but the check was inside the SubsetParameterization
constructor.

3. Added more tests and refactored existing tests to be more
granular.

Change-Id: Ic0184a1f30e3bd8a416b02341781a9d98e855ff7
2016-09-22 20:33:53 -07:00
Sameer Agarwal a36693f83d Update version history
Change-Id: Ib2f0138ed7a1879ca3b2173e54092f7ae8dd5c9d
2016-09-17 16:31:41 -07:00
David Gossow 01e23e3d33 Removing duplicate include directive.
Change-Id: I729ae6501497746d1bb615cb893ad592e16ddf3f
2016-09-08 13:35:19 +00:00
Sameer Agarwal 99b8210cee Update Android.mk to include new files.
Change-Id: Id543ee7d2a65b65c868554a17f593c0a4958e873
2016-09-07 15:31:30 -07:00
Sameer Agarwal 195d8d13a6 Remove two DCHECKs from CubicHermiteSpline.
They were present as debugging checks but were causing problems
with the build on 32bit i386 due to numerical cancellation issues,
where x ~ -epsilon.

Removing these checks only changes the behaviour in Debug mode.
We are already handling such small negative numbers in production
if they occur. All that this change does is to remove the crash.

https://github.com/ceres-solver/ceres-solver/issues/212

Thanks to @NeroBurner and @debalance for reporting this.

Change-Id: I66480e86d4fa0a4b621204f2ff44cc3ff8d01c04
2016-09-06 07:15:20 -07:00
Sameer Agarwal 83041ac84f Fix some compiler warnings.
Reported by Richard Trieu.

Change-Id: I202b7a7df09cc19c92582d276ccf171edf88a9fb
2016-09-02 19:10:35 -07:00
Sameer Agarwal 8c4623c63a Update ExpectArraysClose to use ExpectClose instead of EXPECT_NEAR
The documentation for ExpectArraysClose and its implementation
did not match.

This change makes the polynomial_test not fail on 64bit AMD builds.

Thanks to Phillip Huebner for reporting this.

Change-Id: I503f2d3317a28d5885a34f8bdbccd49d20ae9ba2
2016-09-03 02:01:10 +00:00
Sameer Agarwal 2fd39fcecb FindWithDefault returns by value rather than reference.
Returning by reference leads to lifetime issues with the default
value which may go out of scope by the time it is used.

Thanks to @Ardavel for reporting this, as this causes graph_test
to fail on VS2015x64.

https://github.com/ceres-solver/ceres-solver/issues/216

Change-Id: I596481219cfbf7622d49a6511ea29193b82c8ba3
2016-09-01 16:05:06 -07:00
Mike Vitus 716f049a7b Convert pose graph 2D example to glog and gflags.
Change-Id: I0ed75a60718ef95199bb36f33d9eb99157d11d40
2016-08-31 13:55:58 -07:00
David Gossow 46c5ce89dd Fix compiler errors on some systems
This fixes some signed-unsigned comparisons and a missing header
include.

Change-Id: Ieb2bf6e905faa74851bc4ac4658d2f1da24b6ecc
2016-08-31 20:26:53 +00:00
David Gossow b102d53e1d Gradient checker multithreading bugfix.
This is a follow-up on c/7470. GradientCheckingCostFunction calls
callback_->SetGradientErrorDetected() in its Evaluate method,
which will run in multiple threads simultaneously when enabling
this option in the solver. Thus, the string append operation
inside that method has to be protected by a mutex.

Change-Id: I314ef1df2be52595370d9af05851bf6da39bb45e
2016-08-31 20:25:44 +00:00
Sameer Agarwal 79a28d1e49 Rename a confusingly named member of Solver::Options
Solver::Options::numeric_derivative_relative_step_size to
Solver::Options::gradient_check_numeric_derivative_relative_step_size

Change-Id: Ib89ae3f87e588d4aba2a75361770d2cec26f07aa
2016-08-31 07:47:29 -07:00
Sameer Agarwal 358ae741c8 Note that Problem::Evaluate cannot be called from an IterationCallback
Change-Id: Ieabdc2d40715e6b547ab22156ba32e9c8444b7ed
2016-08-31 07:42:00 -07:00
Sameer Agarwal 44044e25b1 Update the NumTraits for Jets
1. Use AVX if EIGEN_VECTORIZE_AVX is defined.
2. Make the cost of division same as the cost of multiplication.

These are updates to the original numtraits update needed for eigen 3.3
that Shaheen Gandhi sent out.

Change-Id: Ic1e3ed7d05a659c7badc79a894679b2dd61c51b9
2016-08-31 06:19:08 -07:00
Sameer Agarwal 4b6ad5d88e Use ProductParameterization in bundle_adjuster.cc
Previously, when using a quaternion to parameterize the camera
orientation, the camera parameter block was split into two
parameter blocks. One for the rotation and another for the
translation and intrinsics. This was to enable the use of the
Quaternion parameterization.

Now that we have a ProductParameterization which allows us
to compose multiple parameterizations, this is no longer needed
and we use a size 10 parameter block instead.

This leads to a more than 2x improvements in the linear solver time.

Change-Id: I78b8f06696f81fee54cfe1a4ae193ee8a5f8e920
2016-08-31 05:46:44 -07:00
Shaheen Gandhi bfc916cf1c Allow ceres to be used with the latest version of Eigen
Change-Id: Ief3b0f6b405484ec04ecd9ab6a1e1e5409a594c2
2016-08-31 12:45:47 +00:00
Alex Stewart edbd48ab50 Enable support for OpenMP in Clang if detected.
- Previously we disabled OpenMP if Clang was detected, as it did not
  support it.  However as of Clang 3.8 (and potentially Xcode 8) OpenMP
  is supported.

Change-Id: Ia39dac9fe746f1fc6310e08553f85f3c37349707
2016-08-31 08:25:11 +00:00
Mike Vitus f6df6c05dd Add an example for modeling and solving a 3D pose graph SLAM problem.
Change-Id: I750ca5f20c495edfee5f60ffedccc5bd8ba2bb37
2016-08-22 15:26:02 -07:00
David Gossow ac3b8e8217 Gradient checking cleanup and local parameterization bugfix
Change the Ceres gradient checking API to make is useful for
unit testing, clean up code duplication and fix interaction between
gradient checking and local parameterizations.

There were two gradient checking implementations, one being used
when using the check_gradients flag in the Solver, the other
being a standalone class. The standalone version was restricted
to cost functions with fixed parameter sizes at compile time, which
is being lifted here. This enables it to be used inside the
GradientCheckingCostFunction as well.

In addition, this installs new hooks in the Solver to ensure
that Solve will fail if any incorrect gradients are detected. This
way, you can set the check_gradient flags to true and detect
errors in an automated way, instead of just printing error information
to the log. The error log is now also returned in the Solver summary
instead of being printed directly. The user can then decide what to
do with it. The existing hooks for user callbacks are used for
this purpose to keep the internal API changes minimal and non-invasive.

The last and biggest change is the way the the interaction between
local parameterizations and the gradient checker works. Before,
local parameterizations would be ignored by the checker. However,
if a cost function does not compute its Jacobian along the null
space of the local parameterization, this wil not have any effect
on the solver, but would result in a gradient checker error.
With this change, the Jacobians are multiplied by the Jacobians
of the respective local parameterization and thus being compared
in the tangent space only.

The typical use case for this are quaternion parameters, where
a cost function will typically assume that the quaternion is
always normalized, skipping the correct computation of the Jacobian
along the normal to save computation cost.

Change-Id: I5e1bb97b8a899436cea25101efe5011b0bb13282
2016-08-18 06:18:43 +00:00
Mike Vitus d4264ec10d Add a quaternion local parameterization for Eigen's quaternion element convention.
Change-Id: I7046e8b24805313c5fb6a767de581d0054fcdb83
2016-08-17 18:28:54 -07:00
Mike Vitus fd7cab65ef Fix typos in the pose graph 2D example.
Change-Id: Ie024ff6b6cab9f2e8011d21121a91931bd987bd1
2016-08-10 09:37:47 -07:00
Mike Vitus 375dc34874 Remove duplicate entry for the NIST example in the docs.
Change-Id: Ic4e8f9b68b77b5235b5c96fe588cc56866dab759
2016-08-05 21:50:48 +00:00
Mike Vitus f554681bf2 Add an example for modeling and solving a 2D pose graph SLAM problem.
Change-Id: Ia89b12af7afa33e7b1b9a68d69cf2a0b53416737
2016-08-05 14:22:27 -07:00
Sameer Agarwal e1bcc6e0f5 Add additional logging for analyzing orderings
Change-Id: Ic68d2959db35254e2895f11294fb25de4d4b8a81
2016-08-02 10:12:04 -07:00
Mike Vitus 16980b4fec Delete the remove_definitons command from sampled_functions
CMakeLists.txt because it will be inherited from the top level examples
CMakeLists.txt.

Change-Id: I25593587df0ae84fd8ddddc589bc2a13f3777427
2016-07-15 13:44:56 -07:00
Mike Vitus a04490be97 Add readme for the sampled_function example.
Change-Id: I9468b6a7b9f2ffdd2bf9f0dd1f4e1d5f894e540c
2016-07-14 17:06:38 -07:00
Alex Stewart ff11d0e63d Use _j[0,1,n]() Bessel functions on MSVC to avoid deprecation errors.
- Microsoft deprecated the POSIX Bessel functions: j[0,1,n]() in favour
  of _j[0,1,n](), it appears since at least MSVC 2005:
  https://msdn.microsoft.com/en-us/library/ms235384(v=vs.100).aspx.
- As this occurs in jet.h (templated public header), although Ceres
  suppresses the warning when it itself is built (to suppress a warning
  about the insecurity of using std::copy), it will crop up again in
  client code (without this fix) unless it is explicitly suppressed
  there also.
- Raised as Issue #190:
  https://github.com/ceres-solver/ceres-solver/issues/190.

Change-Id: If7ac5dbb856748f9900be93ec0452a40c0b00524
2016-06-29 09:33:45 +01:00
Nicolai Wojke 8ea86e1614 Fix: Copy minimizer option 'is_silent' to LinSearchDirection::Options
Change-Id: I23b4c3383cad30033c539ac93883d77c8dd4ba1a
2016-04-25 14:24:41 +02:00
Sameer Agarwal 080ca4c5f2 Fix typos in users.rst
Change-Id: Ifdc67638a39403354bc9589f42a1b42cb9984dd2
2016-04-24 22:46:54 -07:00
Sameer Agarwal 21ab397dc5 Make some Jet comparisons exact.
Change-Id: Ia08c72f3b8779df96f5c0d5a954b2c0a1dd3a061
2016-04-24 21:13:00 -07:00
Sameer Agarwal ee40f954cf Add colmap to users.rst
Change-Id: I452a8c1dc6a3bc55734b2fc3a4002ff7939ba863
2016-04-24 07:56:12 -07:00
Sameer Agarwal 9665e09902 Fix step norm evaluation in LineSearchMinimizer
TrustRegionMinimizer evaluates the size of the step
taken in the ambient space, where as the LineSearchMinimizer
was using the norm in the tangent space. This change fixes
this discrepancy.

Change-Id: I9fef64cbb5622c9769c0413003cfb1dc6e89cfa3
2016-04-19 00:08:06 +00:00
Alex Stewart 620ca9d066 Remove use of -Werror when compiling Ceres.
- As noted in Issue #193 (in that case for GCC 6), Ceres' use of -Werror
  when compiling on *nix can prevent compilation on new compilers that
  add new warnings and there is an inevitable delay between new compiler
  versions and Ceres versions.
- Removing the explicit use of -Werror, and relying on indirect
  verification by maintainers should fix build issues for Ceres releases
  on newer compilers.

Change-Id: I38e9ade28d4a90e53dcd918a7d470f1a1debd7b4
2016-04-18 15:14:11 +01:00