Commit Graph

1808 Commits

Author SHA1 Message Date
Tobias Schlüter 8637249945 Use portable expression for constant 2/sqrt(pi)
M_2_SQRTPI is not part of standard C++, replace it with an
equivalent expression.  gcc immediately folds this and thus
generates the same code even at -O0.

Change-Id: I5d38e67a4508c1d43a1a8e5f1639f2243cdb143e
2021-01-30 23:19:07 +09:00
Sameer Agarwal 97873ea658 Add some missing includes for glog/logging.h
Change-Id: Ia10c2809eb360bd30efddc0cd941b0de06ac09d6
2021-01-21 13:49:38 -08:00
Sameer Agarwal d15b1bcd3e Increase tolerance in small_blas_test.cc
Change-Id: I7b8460bec65e56029d01c293e83743e99a57d10c
2021-01-12 09:15:05 -08:00
Austin Schuh 17cf018314 Hide 'format not a string literal' error in examples
Change-Id: Ieb3d24438f1c5ec46d3a1de049e63c65ae2ed312
2021-01-04 22:58:20 +00:00
Austin Schuh 64029909b3 Fix -Wno-maybe-uninitialized error
One of my compilers couldn't deduce that Chunk was assigned before being
used based on the context.  Make it more obvious...

Change-Id: I1e331c6c02a2783eff8db03c6359823ac3c46686
2021-01-04 14:44:49 -08:00
Austin Schuh 21294123d7 Fix nonnull arg compared to NULL error.
external/com_google_ceres_solver/internal/ceres/rotation_test.cc: In member function 'bool ceres::internal::IsNormalizedQuaternionMatcher::gmock_Impl<arg_type>::MatchAndExplain(typename testing::internal::ConstRef<arg_type>::type, testing::MatchResultListener*) const [with arg_type = const double (&)[4]]':
external/com_google_ceres_solver/internal/ceres/rotation_test.cc:74:3: error: nonnull argument 'arg' compared to NULL [-Werror=nonnull-compare]
   if (arg == NULL) {
   ^~

Change-Id: I21abd87e97e44188580f4926b3700dc321fecb0e
2021-01-04 14:44:11 -08:00
Austin Schuh 1dd4174109 Fix -Wno-format-nonliteral
GCC doesn't like printf formats which aren't char strings.

Change-Id: I41464ba336076b892d893a5729611488c159f01d
2021-01-04 14:40:44 -08:00
Austin Schuh 6c106bf510 Fix -Wmissing-field-initializers error
Clang was complaining that fields were uninitialized.

Change-Id: Iff76fb2ebf823eb072465c0b0381a4a5cdee0fa9
2020-12-23 22:50:28 -08:00
Austin Schuh c48a327927 Use cc_binary includes so examples build as external repo
When the examples are built from an external repo, the -I flag doesn't
point anywhere useful.  Bazel has an includes option to handle this, so
just use that instead.

Change-Id: Ic768bd60c547948959912193765d4097ec0adf8c
2020-12-23 22:37:59 -08:00
Austin Schuh e0e14a5cdb Fix errors found by -Werror
"'const' type qualifier on return type has no effect" is one of the
errors, and an unused parameter for another.

Change-Id: Ib4bc245d992c1fc1bea0b25d5396871ca1df8411
2020-12-23 22:37:54 -08:00
Sameer Agarwal e84cf10e13 Fix an errant double in TinySolver.
Thanks to Bogdan Burlacu for pointing this out.

Change-Id: I7a59a589c1bf919954e4905df3376e9aeb1a12d7
2020-12-14 08:55:05 -08:00
Mykyta Kozlov 66b4c33e81 updated unit quaternion rotation
Change-Id: I3e5a2ca8e19c1d66437ac16d615867e2a12f8e60
2020-11-18 17:00:13 +00:00
Sameer Agarwal d45ec47b58 Fix a typo in schur_eliminator.h
Change-Id: Ib2c6ea9598d49ee77e2f0429686045cf58cd8574
2020-11-18 08:59:06 -08:00
Alex Stewart 399cda7730 Update build documentation to reflect detection of Eigen via config mode
Change-Id: I18d5f0fc1eb51ea630164c911d935e9bffea35ce
2.0.0
2020-10-23 19:36:08 +01:00
Sameer Agarwal bb127272f9 Fix typos.
Contributed by Ishamis@, IanBoyanZhang@, gkrobner@ & mithunjacob@.

Change-Id: Iab3c19a07a6f3db2486e3557dcb55bfe5de2aee5
2020-10-19 09:32:47 -07:00
Sameer Agarwal a0ec5c32af Update version history for 2.0.0RC2
Change-Id: I75b7515fbf9880bd8eaea6ecd5e72ce1ae4a3a86
2.0.0rc2
2020-10-18 15:20:36 -07:00
Taylor Braun-Jones 3f6d273676 Unify symbol visibility configuration for all compilers
This makes it possible to build unit tests with shared libraries on MSVC.

Change-Id: I1db66a80b2c78c4f3d354e35235244d17bac9809
2020-10-15 16:56:07 -04:00
Sameer Agarwal 29c2912ee6 Unbreak the bazel build some more
Change-Id: I6bbf3df977a473b9b5e16a9e59da5f535f8cdc24
2020-10-13 12:07:06 -07:00
Sameer Agarwal bf47e1a368 Fix the Bazel build.
1. Fix the path to eigen, now that it uses gitlab instead of bitbucket.
2. Remove an unrecognized compiler option.
3. Remove an obsolete benchmark.

This CL only unbreaks the build, it is likely that it is still not
at par with the cmake build.

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

Change-Id: I470209cbb48b6a4f499564a86b52436e0c8d98ef
2020-10-13 10:01:57 -07:00
Nikolaus Demmel 600e8c529e fix minor typos
all timing values in the summary are initialized to -1, so the one
+1 is likely an oversight.

Change-Id: Ie355f3b7da08a56d49d19ca9a5bc48fe5581dee3
2020-10-12 23:01:02 +02:00
Nikolaus Demmel bdcdcc78af update docs for changed cmake usage
- update links to cmake docs to version 3.5
- highlight difference between dependencies with and without custom
  find modules
- point out removal of CERES_INCLUDE_DIRS
- point out that TBB might be linked if SuiteSparseQR is found
- added 'Migration' section
- fixed typos

Change-Id: Icbcc0e723d11f12246fb3cf09b9d7c6206195a82
2020-10-12 20:50:56 +00:00
Sameer Agarwal 3f69e5b36a Corrections from William Rucklidge
Change-Id: I0b5d4808be48f68df7829c70ec93ffa67d81315d
2020-10-12 11:46:40 -07:00
Sameer Agarwal 8bfdb02fb1 Rewrite uses of VLOG_IF and LOG_IF.
VLOG_IF's evaluation order is ambiguous - does it mean
`if (cond) VLOG(lvl)` or `if (VLOG_IS_ON(lvl) && cond) LOG(INFO)`?
In particular, the way it works now is inconsistent with the way the
rest of the LOG macros evaluate their arguments.
Fixing this would be hard, and the macro's behavior would still surprise
some people. Replacing it with an if statement is simple, clear, and unambiguous.

Change-Id: I97a92d17a932c0a5344a1bf98d676308793ba877
2020-10-12 18:34:24 +00:00
Sameer Agarwal d1b35ffc16 Corrections from William Rucklidge
Change-Id: Ifb50e87aa915d00f9861fe1a6da0acee11bc0a94
2020-10-12 10:58:05 -07:00
Sameer Agarwal f34e80e91f Add dividers between licenses.
Change-Id: I4e4aaa15e0621c5648550cfa622fe0a79f1f4f9f
2020-10-08 12:34:53 -07:00
Sameer Agarwal 65c397daec Fix formatting
Change-Id: Ib4ca8a097059dbb8d2f3a6a888222c0188cb126e
2020-10-07 14:34:52 -07:00
Sameer Agarwal f63b1fea9c Add the MIT license text corresponding to the libmv derived files.
Change-Id: Ie72fb45ae96a7892c00411eee6873db7f0e365a8
2020-10-07 21:33:23 +00:00
Nikolaus Demmel 542613c13d minor formatting fix for trust_region_minimizer.cc
Change-Id: I18ba27825fc23dd0e9e3e15dc13fc0833db01b5b
2020-10-06 22:49:32 +02:00
Sameer Agarwal 6d9e9843d8 Remove inclusion of ceres/eigen.h
The initial reason for this is because of a previous reformatting CL
triggered a macro redefinition warning in the schur eliminator. But
actually it was worse because the reordering had caused the macro
definition to be ignored and caused a performance regression.

This simplifies the generated files, fixes some formatting errors
and recovers the performance.

Change-Id: I9dbeffc38743b3f24b25843feec2e26a73188413
2020-09-28 19:20:24 +00:00
Sameer Agarwal eafeca5dcb Fix a logging bug in TrustRegionMinimizer.
Upon encountering an unsuccessful step (one where the cost goes up)
the the trust region minimizer failed to populate the gradient norm
in the IterationSummary. This would cause the gradient norm to be
logged as zero which is incorrect. Instead it should be the gradient
norm at the current point.

This CL fixes this issue.

Before:
iter      cost      cost_change  |gradient|   |step|    tr_ratio  tr_radius  ls_iter  iter_time  total_time
   0  1.115206e+07    0.00e+00    1.90e+07   0.00e+00   0.00e+00  1.00e+04        0    2.72e-01    1.33e+00
   1  3.687552e+06    7.46e+06    1.84e+08   2.86e+03   6.91e-01  1.06e+04        1    1.32e+00    2.65e+00
   2  3.670266e+10   -3.67e+10    0.00e+00   3.27e+03  -1.07e+04  5.30e+03        1    7.52e-01    3.40e+00
   3  4.335397e+07   -3.97e+07    0.00e+00   2.74e+03  -1.16e+01  1.32e+03        1    7.28e-01    4.13e+00
   4  1.345488e+06    2.34e+06    4.12e+07   1.55e+03   6.87e-01  1.40e+03        1    9.31e-01    5.06e+00
   5  5.376653e+05    8.08e+05    9.99e+06   6.64e+02   7.46e-01  1.59e+03        1    9.64e-01    6.03e+00

After:
iter      cost      cost_change  |gradient|   |step|    tr_ratio  tr_radius  ls_iter  iter_time  total_time
   0  1.115206e+07    0.00e+00    1.90e+07   0.00e+00   0.00e+00  1.00e+04        0    2.37e-01    1.13e+00
   1  3.687552e+06    7.46e+06    1.84e+08   2.86e+03   6.91e-01  1.06e+04        1    1.08e+00    2.21e+00
   2  3.670266e+10   -3.67e+10    1.84e+08   3.27e+03  -1.07e+04  5.30e+03        1    7.50e-01    2.96e+00
   3  4.335397e+07   -3.97e+07    1.84e+08   2.74e+03  -1.16e+01  1.32e+03        1    7.13e-01    3.67e+00
   4  1.345488e+06    2.34e+06    4.12e+07   1.55e+03   6.87e-01  1.40e+03        1    9.01e-01    4.57e+00
   5  5.376653e+05    8.08e+05    9.99e+06   6.64e+02   7.46e-01  1.59e+03        1    9.36e-01    5.51e+00

Change-Id: Iae538fe089be07c7bb219337a6f1392f7213acfe
2020-09-28 12:19:45 -07:00
Alex Stewart 1fd0be916d Fix default initialisation of IterationCallback::cost
Change-Id: I9f529093fc09424c90dbff8e9648b90b16990623
2020-09-28 18:54:33 +01:00
Nikolaus Demmel 137bbe8455 add info about clang-format to contributing docs
Change-Id: I2f4dcbda2e4f36096df217d76de370103ffaa43e
2020-09-28 02:25:12 +02:00
Nikolaus Demmel d3f66d77f4 fix formatting generated files (best effort)
- update file generator scripts / templates so generated files adhere
  to clang-format
- A few exceptions are not fixed, where the file generation results in
  lines of different width. To properly fix this would make the code
  more complicated and it's not that important for generated files
  anyway.
- note that generated files are excluded in ./scripts/format_all.sh

Change-Id: I4f42c83d1fec01242eada5e7ce6c1a5192234d37
2020-09-28 02:24:43 +02:00
Nikolaus Demmel a9c7361c8d minor formatting fix (wrongly updated in earlier commit)
Change-Id: I544635fd936cb5b7f7bd9255876641cd5a9590c6
2020-09-28 02:19:02 +02:00
Nikolaus Demmel 7b8f675bfd fix formatting for (non-generated) internal source files
- Change formatting standard to Cpp11. Main difference is not having
  the space between two closing >> for nested templates. We don't
  choose c++14, because older versions of clang-format (version 9
  and earlier) don't know this value yet, and it doesn't make a
  difference in the formatting.
- Apply clang-format to all (non generated) internal source files.
- Manually fix some code sections (clang-format on/off) and c-strings
- Exclude some embedded external files with very different formatting
  (gtest/gmock)
- Add script to format all source files

Change-Id: Ic6cea41575ad6e37c9e136dbce176b0d505dc44d
2020-09-21 02:52:07 +02:00
Sameer Agarwal 921368ce31 Fix a number of typos in covariance.h
Also some minor cleanups in covariance_impl.h

Thanks to Lorenzo Lamia for pointing these out.

Change-Id: Icb4012a367fdd1f249bc1e7019e0114c868e45b6
2020-09-09 09:39:42 -07:00
Nikolaus Demmel 7b6b2491cc fix formatting for examples
This is mostly just applying the existing clang format config, except:
- Use NOLINT on overlong comment lines.
- Wrap some sections in 'clang-format off' / 'clang format on'.
- Manually split or join some multi-line strings.

Change-Id: Ia1a40eeb92112e12c3a169309afe087af55b2f4f
2020-09-08 17:56:39 +02:00
Nikolaus Demmel 82275d8a4e some fixes for Linux and macOS install docs
Linux:
- Remove workaround for Ubuntu 14.04, which is EOL. libsuitesparse-dev
  seems to come with a shared library on 16.04 and later, so linking
  to a shared build of ceres doesn't seem to be an issue any more.
- Add missing libgflags-dev.

macOS:
- OS X is now called macOS.
- Update homebrew link.
- Mac homebrew the preferred method of installation.
- Fix OpenMP instructions.
- Remove reference to homebrew/science. Everything is in core.
- Add missing gflags.

Change-Id: I633b3c7ea84a87886bfd823f8187fdd0a84737c9
2020-09-08 02:12:08 +00:00
Nikolaus Demmel 9d762d74f0 fix formatting for public header files
- ensure all public headers files adhere to clang-format
- preserve one-per-line for enums by adding trailing comma
- preserve include order for en/disable_warning.h

Change-Id: I78dbd0527a294ab2ec5f074fb426e48b20c393e6
2020-09-07 23:14:51 +02:00
Nikolaus Demmel c76478c489 gitignore *.pyc
Change-Id: Ic6238a617a3c7ce92df7dcefcc44bae20c32b30b
2020-09-07 00:17:50 +02:00
Alex Stewart 4e69a475cd Fix potential for mismatched release/debug TBB libraries
- Protect against the case when the user has multiple installs of TBB
  in their search paths and the first install does not contain debug
  libraries.  In this case it is possible to get mismatched versions
  of TBB inserted into TBB_LIBRARIES.
- Also suppresses warning about use of TBB_ROOT on modern versions of
  CMake due to CMP0074.

Change-Id: I2eaafdde4a028cbf6c500c63771973d85bc4723d
2020-09-03 19:55:58 +01:00
Sameer Agarwal 8e1d8e32ad A number of small changes.
1. Add a move constructor to NumericDiffCostFunction, DynamicAutoDiffCostfunction
   and DynamicNumericDiffCostFunction.
2. Add optional ownership of the underlying functor.
3. Update docs to reflect this as well as the variadic templates that allow an
   arbitrary number of parameter blocks.

Change-Id: I57bbb51fb9e75f36ec2a661b603beda270f30a19
2020-09-03 10:57:50 -07:00
Julian Kent 368a738e52 AutoDiffCostFunction: optional ownership
Add Ownership semantics to the AutoDiffCostFunction

This allows several benefits, such as pointer ordering always being the
same for numerical repeatability (due to blocks being ordered by
pointer address), memory adjacency for better cache performance, and
reduced allocator pressure / overhead.

This is then made use of in libmv by preallocating the errors and
cost functions into vectors

Change-Id: Ia5b97e7249b55a463264b6e26f7a02291927c9f2
2020-09-03 19:19:53 +02:00
Morten Hannemose 8cbd721c19 Add erf and erfc to jet.h, including tests in jet_test.cc
erf is necessary for evaluating Gaussian functions.
erfc was added because it is so similar to erf.

Change-Id: I5e470dbe013cc938fabb87cde3b0ebf26a90fff4
2020-09-03 17:54:20 +02:00
Sameer Agarwal 31366cff29 Benchmarks for dynamic autodiff.
This patch is from Clement Courbet. courbet@google.com

Change-Id: I886390663644733bfa5b7b52b0c883079e793726
2020-09-01 09:25:02 -07:00
Alex Stewart 29fb08aeae Use CMAKE_PREFIX_PATH to pass Homebrew install location
- Passing HINTS disables the MODULE mode of find_package() which
  precludes users from creating their own find modules to provide
  Ceres' dependencies.

Change-Id: I6f2edf429331d13fe67bf61ac4b79d17579d9a57
2020-09-01 10:23:31 +01:00
Sameer Agarwal 242c703b50 Minor fixes to the documentation
Change-Id: I65e6f648d963b8aa640078684ce02dcde6acb87d
2020-08-04 21:02:11 -07:00
Sameer Agarwal 79bbf95103 Add changelog for 2.0.0
Change-Id: I8acad62bfe629454ae5032732693e43fe37b97ff
2.0.0rc1
2020-08-04 18:26:02 -07:00
Sameer Agarwal 41d05f13d0 Fix lint errors in evaluation_callback_test.cc
Change-Id: I63eb069544ad0d8f495490fe4caa07b9f04f7ec2
2020-08-04 14:56:33 -07:00
Sameer Agarwal 4b67903c1f Remove unused variables from problem_test.cc
Change-Id: Ia1a13cfc6e462f6d249dcbf169ad34831dd93ec2
2020-08-04 14:40:50 -07:00