Commit Graph

1477 Commits

Author SHA1 Message Date
Sameer Agarwal 2ffddaccfe Use override & final instead of just using virtual.
This is safer than using virtual and this lead to a minor
bug fixes.

Change-Id: Id69cb1cc569bf6bf245f22f029c7871b6c712568
2019-07-25 16:29:14 -07:00
Sameer Agarwal e4577dd6d9 Use override instead of virtual for subclasses.
Now that we are using c++11, it is safer to use override in subclasses
instead of virtual.

This CL does it for the interface, a follow up CL will do it for
other parts of the code base.

Change-Id: Ice8d0f4355cb700019d7a9c1566fbff0099e97d6
2019-07-25 23:26:24 +00:00
Frank 3e5db5bc27 Fixing documentation typo.
- Matrix had two columns squeezed together

Change-Id: I5f18df15364bd8507db98d43f8a547a9efab0913
2019-07-19 03:03:00 +09:00
Alex Stewart 82d325b731 Avoid memory allocations in Accelerate Sparse[Refactor/Solve]().
- Maintain scratch workspaces for solving/refactoring instead of
  forcing Sparse[Refactor/Solve]() to reallocate space on each call.

Change-Id: Idb9eda9c9c6cc7570cfdf851e59e5bf6b39521ce
2019-07-16 11:10:36 +00:00
Sameer Agarwal f66b513826 Fix some clang-tidy warnings.
Change-Id: Ic71bf0fc561edc22e3051d156fac630fcfea5d92
2019-07-15 13:23:04 -07:00
Alex Stewart 0428e2dd0f Fix missing #include of <memory>
Change-Id: I11a4e232305e3866ed418a65041aa87ce385c071
2019-07-12 18:23:26 +01:00
Sameer Agarwal 487c1aa51f Expose SubsetPreconditioner in the API
https://github.com/ceres-solver/ceres-solver/issues/270

Detailed list of changes:

1. Add SUBSET to the PreconditionerType enum.
2. Add Solver::Options::residual_blocks_for_subset_preconditioner
3. Integrate SubsetPreconditioner into the CGNR solver.
4. Add the reordering logic needed for this to TrustRegionPreprocessor.
5. Expect CreateJacobianBlockTranspose to take the starting row block
   so that we can work with subparts of the Jacobian matrix.
6. Extend the denoising example to use this preconditioner.

As an illustration of its performance, we consider the performance of
denoising -input ../data/ceres_noisy.pgm  --foe_file ../data/5x5.foe

tl;dr

For the same cost,

SPARSE_NORMAL_CHOLESKY -  81s
CGNR + JACOBI          - 718s
CGNR + SUBSET          -  57s

SPARSE_NORMAL_CHOLESKY
======================

Cost:
Initial                          2.317806e+05
Final                            2.232323e+04
Change                           2.094574e+05

Minimizer iterations                       10
Successful steps                           10
Unsuccessful steps                          0

Time (in seconds):
Preprocessor                         2.999746

  Residual only evaluation           2.306811 (10)
  Jacobian & residual evaluation     7.421727 (10)
  Linear solver                     65.517273 (10)
Minimizer                           78.731011

Postprocessor                        0.026079
Total                               81.756836

Termination:                      CONVERGENCE (Function tolerance reached. |cost_change|/cost: 8.573046e-04 <= 1.000000e-03)

CGNR + JACOBI
=============
Cost:
Initial                          2.317806e+05
Final                            2.232344e+04
Change                           2.094572e+05

Minimizer iterations                       10
Successful steps                           10
Unsuccessful steps                          0

Time (in seconds):
Preprocessor                         0.648814

  Residual only evaluation           2.297607 (10)
  Jacobian & residual evaluation     7.327886 (10)
  Linear solver                    699.601248 (10)
Minimizer                          712.419493

Postprocessor                        0.024014
Total                              713.092321

Termination:                      CONVERGENCE (Function tolerance reached. |cost_change|/cost: 8.528538e-04 <= 1.000000e-03)

CGNR + SUBSET (random 20% residuals used for the preconditioner)
===============================================================
Cost:
Initial                          2.317806e+05
Final                            2.232327e+04
Change                           2.094574e+05

Minimizer iterations                       10
Successful steps                           10
Unsuccessful steps                          0

Time (in seconds):
Preprocessor                         1.472743

  Residual only evaluation           2.428315 (10)
  Jacobian & residual evaluation     7.367796 (10)
  Linear solver                     42.585999 (10)
Minimizer                           55.664459

Postprocessor                        0.024098
Total                               57.161301

Termination:                      CONVERGENCE (Function tolerance reached. |cost_change|/cost: 8.538277e-04 <= 1.000000e-03)

Change-Id: Ifb011408bd53edbb9439b0b7345649a38f999e18
2019-07-12 16:08:36 +02:00
Sameer Agarwal bf709ecac2 Move EvaluationCallback from Solver::Options to Problem::Options.
Adding it to Solver::Options was a mistake, as it prevents it from
being used in covariance estimation. Also updated associated docs.

https://github.com/ceres-solver/ceres-solver/issues/380
https://github.com/ceres-solver/ceres-solver/issues/401
https://github.com/ceres-solver/ceres-solver/issues/484

Change-Id: I63809a47a58e84c04a58bf8e59ace92f45fc2873
2019-07-08 21:24:08 +02:00
Scott K Logan 059bcb7f86 Drop ROS dependency on catkin
As a pure CMake package, ceres-solver doesn't need catkin to be built.
This change makes the package buildable using colcon as well.

Change-Id: I3c21f201f947a0e4e87da2708ab9e799816ba97a
2019-06-26 16:07:52 +00:00
Alex Stewart c4dbc927d6 Default to any other sparse libraries over Accelerate
- Accelerate currently does not support dynamic sparsity, whereas the
  other sparse linear algebra libraries do (outstanding issue to update)
- Previously we preferred Accelerate to all but SuiteSparse if it was
  available, which breaks the dynamic_sparsity_test if SuiteSparse is
  *not* available (even if others are) as Accelerate does not support
  dynamic sparsity.

Change-Id: Ibc2dd2f14f83cffbecca38097d02bb2188aaaa05
2019-06-26 16:53:09 +01:00
Sameer Agarwal db1f5b57a0 Allow some methods in Problem to use const double*.
Some methods in Problem do not modify the parameter block
and those methods now allow the user to call them with const double*.

The methods are

RemoveParameterBlock
SetParameterBlockConstant
IsParameterBlockConstant
GetParameterization
GetParameterLowerBound
GetParameterUpperBound

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

Change-Id: I59dcb77134f59576dd498bd732e29aae9abd28b1
2019-06-05 15:45:02 -07:00
huangqinjin a60c14525f Explicitly delete the copy constructor and copy assignment operator
The implicitly-declared copy constructor and copy assignment operator
of ProductParameterization are not deleted since the corresponding
functions of the member vector are defined, though ill-formed if they
are instantiated.

With dllexport, the compiler must generate all of the member functions
of the class, including those are implicitly-declared, so we need
explicitly delete the ill-formed ones.

Change-Id: Iaa763dfaefdc74a9840f244ba05c6bfd0bd99492
2019-06-05 05:09:30 +00:00
Sameer Agarwal 084042c252 Lint changes from William Rucklidge
Update documentation for
Solver::Options::max_num_line_search_step_size_iterations

Change-Id: I03edc74e67940bed0be7e5ccaffed9e97114a5a5
2019-05-31 09:00:40 -07:00
Sameer Agarwal 93d869020b Use selfAdjoingView<Upper> in InvertPSDMatrix.
This restores some sensitive numerical tests.

Change-Id: I7e6fc0236e810b1c112af75067957740c40c8f36
2019-05-30 20:56:55 -07:00
Sameer Agarwal a0cd0854aa Speed up InvertPSDMatrix
For matrices of size <= 4, Eigen implements an optimized matrix
inverse, which is orders of magnitude faster than computing the
Cholesky factorization and inverting it. This can have a significant
impact on the performance of the SchurEliminator.

This change implements this optimization, adds tests and benchmarks.

Before this change on my MacBook Pro

-----------------------------------------------------------------------------------
Benchmark                                            Time           CPU Iterations
-----------------------------------------------------------------------------------
BenchmarkFixedSizedInvertPSDMatrix<1>                0 ns          0 ns 1000000000
BenchmarkFixedSizedInvertPSDMatrix<2>              102 ns        101 ns    6504851
BenchmarkFixedSizedInvertPSDMatrix<3>     	   164 ns        164 ns    4297669
BenchmarkFixedSizedInvertPSDMatrix<4>              200 ns        200 ns    3933623
BenchmarkFixedSizedInvertPSDMatrix<5>              353 ns        353 ns    1930454
BenchmarkFixedSizedInvertPSDMatrix<6>              428 ns        427 ns    1629074
BenchmarkFixedSizedInvertPSDMatrix<7>              559 ns        558 ns    1211639
BenchmarkFixedSizedInvertPSDMatrix<8>              527 ns        527 ns    1000000
BenchmarkFixedSizedInvertPSDMatrix<9>              873 ns        873 ns     902713
BenchmarkFixedSizedInvertPSDMatrix<10>             892 ns        892 ns     787410
BenchmarkFixedSizedInvertPSDMatrix<11>            1201 ns       1201 ns     564334
BenchmarkFixedSizedInvertPSDMatrix<12>            1081 ns       1080 ns     588359
BenchmarkDynamicallyInvertPSDMatrix/1              322 ns        322 ns    2244892
BenchmarkDynamicallyInvertPSDMatrix/2              362 ns        362 ns    1869693
BenchmarkDynamicallyInvertPSDMatrix/3              455 ns        455 ns    1604092
BenchmarkDynamicallyInvertPSDMatrix/4              443 ns        443 ns    1578062
BenchmarkDynamicallyInvertPSDMatrix/5              648 ns        647 ns     963232
BenchmarkDynamicallyInvertPSDMatrix/6              756 ns        755 ns     899766
BenchmarkDynamicallyInvertPSDMatrix/7              906 ns        905 ns     740506
BenchmarkDynamicallyInvertPSDMatrix/8              885 ns        885 ns     790657
BenchmarkDynamicallyInvertPSDMatrix/9             1219 ns       1219 ns     600503
BenchmarkDynamicallyInvertPSDMatrix/10            1267 ns       1266 ns     534555
BenchmarkDynamicallyInvertPSDMatrix/11            1580 ns       1579 ns     469591
BenchmarkDynamicallyInvertPSDMatrix/12            1366 ns       1365 ns     514513

after this change:

-----------------------------------------------------------------------------------
Benchmark                                            Time           CPU Iterations
-----------------------------------------------------------------------------------
BenchmarkFixedSizedInvertPSDMatrix<1>                0 ns          0 ns 1000000000
BenchmarkFixedSizedInvertPSDMatrix<2>                1 ns          1 ns 1000000000
BenchmarkFixedSizedInvertPSDMatrix<3>                1 ns          1 ns  514399512
BenchmarkFixedSizedInvertPSDMatrix<4>                2 ns          2 ns  320587683
BenchmarkFixedSizedInvertPSDMatrix<5>              372 ns        372 ns    1856986
BenchmarkFixedSizedInvertPSDMatrix<6>              446 ns        446 ns    1552502
BenchmarkFixedSizedInvertPSDMatrix<7>              571 ns        570 ns    1208021
BenchmarkFixedSizedInvertPSDMatrix<8>              586 ns        584 ns    1090988
BenchmarkFixedSizedInvertPSDMatrix<9>             1003 ns       1001 ns     753279
BenchmarkFixedSizedInvertPSDMatrix<10>            1074 ns       1070 ns     689974
BenchmarkFixedSizedInvertPSDMatrix<11>            1361 ns       1351 ns     545388
BenchmarkFixedSizedInvertPSDMatrix<12>            1160 ns       1158 ns     615742
BenchmarkDynamicallyInvertPSDMatrix/1              326 ns        326 ns    2206552
BenchmarkDynamicallyInvertPSDMatrix/2              362 ns        361 ns    1820982
BenchmarkDynamicallyInvertPSDMatrix/3              432 ns        431 ns    1696361
BenchmarkDynamicallyInvertPSDMatrix/4              473 ns        472 ns    1294115
BenchmarkDynamicallyInvertPSDMatrix/5              657 ns        656 ns     917888
BenchmarkDynamicallyInvertPSDMatrix/6              804 ns        802 ns     884050
BenchmarkDynamicallyInvertPSDMatrix/7              936 ns        935 ns     679565
BenchmarkDynamicallyInvertPSDMatrix/8              915 ns        915 ns     695548
BenchmarkDynamicallyInvertPSDMatrix/9             1299 ns       1293 ns     583256
BenchmarkDynamicallyInvertPSDMatrix/10            1300 ns       1296 ns     562959
BenchmarkDynamicallyInvertPSDMatrix/11            1617 ns       1610 ns     480393
BenchmarkDynamicallyInvertPSDMatrix/12            1380 ns       1379 ns     503934

Change-Id: Id0d3bbe6d610ee7a3004bb8e2b657b90307b9805
2019-05-30 18:15:01 -07:00
Sameer Agarwal 7b53262b7f Allow Solver::Options::max_num_line_search_step_size_iterations = 0.
This change only affects the TRUST_REGION minimizer and has no effect
on the LINE_SEARCH minimizer.

This options controls the number of iterations that the line search
algorithm performs. The line search algorithm is as the name implies,
used in the LINE_SEARCH minimizer. It is also used by the TRUST_REGION
minimizer when solving bounds constrained optimization problems.

In some bounds constrained problems, it is enough to project each step
onto the bounds constraints and not perform the line search. This can
have a significant impact on runtime. Setting
Solver::Options::max_num_line_search_step_size_iterations = 0 enables
this functionality.

Changchang Wu (ccwu@google.com) came up with the idea for this
implementation.

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

Change-Id: Ifbe0bc5c48eedb2c1231d43cd98e4be7316c0682
2019-05-30 15:16:41 -07:00
Sameer Agarwal 3e2cdca542 Make LineSearchMinizer work correctly with negative valued functions.
When reasoning about the function_tolerance based convergence,
LineSearchMinimizer assumed that the objective function is
positive. This used to be the case when LineSearchMinimizer was used
for minimizing non-linear least squares problems. However, with
GradientProblemSolver, the objective function can be negative (for
example when maximizing a function).

This change the minimizer to use the absolute value of the change
from one iteration to another.

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

Change-Id: I831e2db96b092374e167c582ab1480b1831d5650
2019-05-13 10:20:50 -07:00
Sameer Agarwal 3ff12a878b Fix a clang-tidy warning in problem_test.cc
Change-Id: Iaf26db5711c13e802123a4de724c0445eec884f9
2019-04-29 11:16:09 -07:00
Sameer Agarwal 57441fe909 Fix two bugs.
1. ProblemEvaluateResidualTest was leaking the loss_function in cases
where it was not being used.
2. Fix a grammo in rotation.h

Change-Id: If94ae1624033c8f6d1934dc2f40fa0dfe4e025c3
2019-04-29 10:59:09 -07:00
Sameer Agarwal 1b852c57e0 Add Problem::EvaluateResidualBlock.
This method gives the user the ability to evaluate a given residual
block.

A couple of minor cleanups.

Problem::problem_impl_ -> Problem::impl_
NULL -> nullptr

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

Change-Id: I6dd94762c475fa264c387b8c93d516f6e06fe832
2019-04-29 09:46:33 -07:00
Sergey Sharybin 54ba6c27b5 Fix missing declaration warnings in Ceres code
This commit includes the following:

- Changes to CMake to make it safer to see which compiler flags are supported,
  so this way we do not need to worry about version checks in CMake.

- Unix platforms (which includes both Linux and Apple as far as i can tell)
  will now enable -Wmissing-declarations warning for the whole Ceres.

- Changes in all sources to solve missing declaration warning. In most cases
  it was either matter of using static qualifier or moving functions to an
  anonymous namespace.

  In one case the function got removed, since it seems to be unused.

  Additionally, in slam examples there was a non-inlined function implementation
  in a header, which is a direct way to cause linking errors if other .cc file
  will include that helper header.

- All third party sources (which is currently only gmock) has this extra
  paranoid warning disabled.

This warning is important in the following cases:

- Detect helper functions which are not needed anymore.
- Avoid unnoticed pollution of namespace.
- Avoid bad level calls.
- Avoid missing updates in header files after changes in implementation file.
- Helps integrating Ceres into software where paranoid warnings are important.

Change-Id: I9b1044aced3910d8c6b2356cfe2bf57f3c8c58db
2019-04-23 12:16:28 +02:00
Johannes Beck fac46d50eb Modernize ProductParameterization.
This CL modernizes ProductParameterization in the following ways:
- It uses std::unique_ptr for memory handling instead of using raw
  pointers and handmade memory management.
- Replaces the constructors with a variadic template.

Change-Id: I5c9fe42ac935b6c26e867dbd3369a4c766623047
2019-04-19 13:36:37 +02:00
Sameer Agarwal 53dc6213fa Add some missing string-to-enum-to-string convertors.
LoggingTypeToString
StringtoLoggingType
DumpFormatTypeToString
StringtoDumpFormatType

Fixes https://github.com/ceres-solver/ceres-solver/issues/470

Change-Id: Ic7eb98dada008c869a686fbdf2c7ff9ab81dad54
2019-04-18 07:58:30 -07:00
Johannes Beck c0aa9a2631 Add checks in rotation.h for inplace operations.
Some rotation functions like UnitQuaternionRotatePoint,
QuaternionRotatePoint, etc. will calculate bad results if the input
point and output point points to the same memory (inplace operation).

This CL adds checks in debug mode to guard against it.

Change-Id: Id0a30e9a0286b340757f0790d417d9f9a3409810
2019-04-16 21:45:36 +02:00
Keir Mierle 0f57fa82db Update Bazel WORKSPACE for newest Bazel
The latest Bazel releases have deprecated Bazel-native
"http_archive()" directive in favor of a Skylark version.
This updates the WORKSPACE to use the new format, as well
as removing the Eigen BUILD in favor of a string in the
WORKSPACE.

Fixes: https://github.com/ceres-solver/ceres-solver/issues/463

Change-Id: I2f7051316dbe0c1f283423c56b7672ab83a30860
2019-04-16 01:04:59 -07:00
ngoclinhng f8e5fba7b9 TripletSparseMatrix: guard against self-assignment
Change-Id: I63159b32d0462fe784019f17242cf4a9f05b2825
2019-04-16 02:51:34 +00:00
Johannes Beck 939253c208 Fix Eigen alignment issues.
For proper alignment on the heap Eigen needs to have a custom
allocator. There are two forms, new and in-place new. To make sure
that memory is aligned using new, one needs to overload new by
adding EIGEN_MAKE_ALIGNED_OPERATOR_NEW to any struct which contains a
fixed size Eigen type either through inheritance or as a direct or
indirect member. For the in-place new one need to use the
Eigen::aligned_allocator (e.g. for std::vector, std::list,
FixedArray, etc.). For more details see:
https://eigen.tuxfamily.org/dox/group__DenseMatrixManipulation__Alignement.html

This CL adds EIGEN_MAKE_ALIGNED_OPERATOR_NEW to all structs, which
contain fixed-size Eigen types and uses the Eigen::aligned_allocator
for containers which stores structs of fixed-size Eigen types.

Change-Id: I06c6c4fc74a6835918d5d1c571b7814a14c029d8
2019-04-15 22:09:24 +02:00
Sameer Agarwal bf67daf79e Add the missing <array> header to fixed_array.h
Change-Id: I1f48bd6eab0c6b189d01c68d4940a586a968581f
2019-04-11 10:35:04 -07:00
Johannes Beck 25e1cdbb6f Switch to FixedArray implementation from abseil.
This PR changes the implementation of the current fixed array to the
abseil one, which has proper allocator support.
Some minor changes are made to make the fixed array implementation
self-contained (no dependent to abseil):
- No address sanitizer support (red zones, etc.)
- Remove of noexecpt specified for copy and move constructor.
- Remove of 'at' function as Ceres does not use exceptions.
- Use std::tuple instead of absl::CompressedTuple as it uses the  abseil
  utility header which includes a whole bunch of other headers.

Change-Id: I43445b42c37f944509b5353a587d0efce74cbccf
2019-04-08 19:44:16 +00:00
Sameer Agarwal d467a627b5 IdentityTransformation -> IdentityParameterization
Change-Id: I77b32a3ec4fd666ce99e2248eb50c851d7bb4b0d
2019-04-02 06:43:31 -07:00
Sameer Agarwal eaec6a9d0c Fix more typos in CostFunctionToFunctor documentation.
Change-Id: I337e67152e4c00b91f7b8f0bb471d5a1896f46dc
2019-03-10 20:57:09 -07:00
Sameer Agarwal 99b5aa4aa5 Fix typos in CostFunctionToFunctor documentation.
Thanks to jss.chandler00@gmail.com for reporting this.

Change-Id: I05cc1f17edec227dc0526b2b63a9fb4a4209772f
2019-03-10 14:02:11 +00:00
Alex Stewart ee7e2cb3c8 Set Homebrew paths via HINTS not CMAKE_PREFIX_PATH
- Adding the Homebrew install prefix to CMAKE_PREFIX_PATH, irrespective
  of whether it is a standard location (e.g. /usr/local) overrides any
  user-specified HINTS locations according to the search order of
  CMake's find_xxx() functions.
- Now we append the relevant include/lib directory to its respective
  HINTS directory variable (to the back to avoid overriding any user
  specified values).  This achieves the same effect, but only after
  searching any user specified values.
- Also adds Homebrew install prefix to find_package() calls for
  dependencies optionally exported with CMake after the possible user
  specified <DEPENDENCY_NAME>_DIR prefix.
- Raised as issue #431

Change-Id: I47030f0f4fd9b96665fac57279be2285d9700b9a
2019-03-07 22:12:44 +00:00
Sameer Agarwal 4f8a018531 Revert "Fix custom Eigen on macos (EIGEN_INCLUDE_DIR_HINTS)"
This reverts commit e6c5c7226d.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I38b6a0ae0a7d835d05505d1baae33a52f4752a33
2019-03-07 22:11:03 +00:00
Nikolaus Demmel e6c5c7226d Fix custom Eigen on macos (EIGEN_INCLUDE_DIR_HINTS)
In ceres' CMakeLists.txt a workaround for custom homebrew locations
sets CMAKE_PREFIX_PATH to the homebrew install path. This overrides
explicit requests for custom locations for third-party dependencies,
in particular for Eigen with EIGEN_INCLUDE_DIR_HINTS.

This commit introduces a workaround to make EIGEN_INCLUDE_DIR_HINTS
work on macos by ignoring CMAKE_PREFIX_PATH in that case.

Fixes https://github.com/ceres-solver/ceres-solver/issues/431

Change-Id: I3ec0ec418d45d41b9e5ebdd6aee60552438afec3
2019-03-07 22:08:44 +00:00
Sameer Agarwal 5a56d522e8 Add the 3,3,3 template specialization.
Change-Id: I32bd528ee5b1c267d6dc7aa3ab58768851748e24
2019-03-07 15:42:28 +00:00
Sam Hasinoff df5c231169 Reorder initializer list to make -Wreorder happy
Change-Id: Ib8351099694a3a9287dd3d5e3fb0491940b64d3c
2019-03-03 16:48:03 -08:00
Sameer Agarwal 0fcfdb0b41 Fix the build breakage caused by the last commit.
Change-Id: I0145c7008e8272f4b7f3ce9134dd3e7128d9059a
2019-03-03 12:16:23 -08:00
Sameer Agarwal 9b9e9f0dc8 Reduce machoness of macro definition in cost_functor_to_function_test.cc
Nuff said.

Change-Id: Ie38ca63bc0fb3b62f68ab330fc452e94071724aa
2019-03-03 11:50:14 -08:00
huangqinjin 21d40daa00 Remove UTF-8 chars
Change-Id: I1e98dd7441d2de05e0b3b0937e496103177631f8
2019-03-03 18:53:13 +00:00
Alex Stewart 9350e57a45 Enable optional use of sanitizers
- The list of sanitizers to compile with can now be specified via the
  SANITIZERS option.

Change-Id: I9af3976e09582d8b3649cb12dc3e94333944d69f
2019-03-03 18:38:26 +00:00
Alex Stewart 0456edffbc Update Travis CI Linux distro to 16.04 (Xenial)
Change-Id: I74638b2defd2992304fcf64fc2be5b2c07ad247f
2019-03-03 12:46:44 +00:00
Sameer Agarwal bef0dfe355 Fix a typo in cubic_interpolation.h
https://github.com/ceres-solver/ceres-solver/issues/439

Change-Id: Ib8c5b2511dd8b162784f387f1624d8568b3a57df
2019-03-02 23:06:28 -08:00
Sameer Agarwal 056ba9bb1d Add AutoDiffFirstOrderFunction
This is to FirstOrderFunction, what AutoDiffCostFunction is to CostFunction.
This allows users of GradientSolver to be able to define objective functions
without requiring them to define the derivatives.

The implementation uses the same Jet objects for computing the gradient as
is used by AutoDiffCostFunction.

Change-Id: Ide6e60532a3adab9be9899ba9b368dc267fd2dbb
2019-03-03 06:50:56 +00:00
Sameer Agarwal 6e527392da Update googletest/googlemock to db9b85e2.
Also update all callsites to use INSTANTIATE_TEST_SUITE_P instead
of INSTANTIATE_TEST_CASE_P which has been deprecated.

Also some minor clang-format changes.

Change-Id: If9d0a77931536ac0765d8435068d00e4471f59d0
2019-03-02 22:42:20 -08:00
Patrik Huber 1b29407490 Clarify documentation of BiCubicInterpolator::Evaluate for out-of-bounds values
This updates outdated documentation and clarifies that supplying out-of-bound values for r and c is fine.
See https://github.com/ceres-solver/ceres-solver/issues/457.

Change-Id: I4a812786ebd05ec5bfedd388edbc71839434cc71
2019-02-08 22:33:44 +00:00
Johannes Beck e51e9b46f6 Implement AddResidualBlock using variadic templates
This CL changes the implementation of AddResidualBlock() in
ceres::Problem using variadic templates. Also one new overload for
AddResidualBlock() is added using a double** and the number of
parameter blocks.

Change-Id: I007a82a06897335a117213a0d12fedb4a77076a0
2018-11-07 21:02:11 +01:00
Sameer Agarwal e243fd292d remove the use of DCHECK_NOTNULL from numeric_diff.h
Change-Id: I7fc258812b1fe4aa727eaeb9b9b834d04a631abd
2018-11-02 06:33:21 -07:00
Johannes Beck 5ec88f6e44 Fix Jacobian evaluation for constant parameter
This CL fixes a regression bug in numeric differentiation where the
differentiation is called even if the parameter block is hold constant.
This resulted into a write to a nullptr.

A unit test is added for Jacobian evaluation of constant parameters.

Change-Id: Ia0f7c6cc7ef18f0f2cd6d758a839729b8ff606a0
2018-11-02 08:51:24 +01:00
Christopher Wecht 7b0ce1adc4 AutoDiffCostFunction: use static_assert to check if the correct overload of the constructor is used.
Change-Id: Iad06843b858ac45e87c0458522657b2e2c55f4e8
2018-10-29 13:56:25 +00:00