Commit Graph

21 Commits

Author SHA1 Message Date
Sergiu Deitsch c8658c8992 Modernize more
Apply clang-tidy Google and modernize fixes without trailing return type
using:

$ clang-tidy -p <build-dir> \
  -checks='-*,google-*,modernize-*,-modernize-use-trailing-return-type' {} -fix

Change-Id: I7450cc58ea9abf928f73a467e87876083217fa26
2022-02-26 22:16:56 +00:00
Sergiu Deitsch f90833f5fa Simplify symbol export
Currently, the logic for exporting symbols is rather complicated: when
tests are enabled internal symbols are exported in addition to the
public symbols. Such logic causes several problems. (1) Test binaries
link against a Ceres build that is different from the final release
since fewer optimizations are applied if more symbols are exported. (2)
Also, some toolchains hide symbols by default breaking the existing
logic eventually causing linker errors.

Since internal symbols are not intended to be used outside of the
project, we can compile them into object files and use exactly the same
binary code both for the final build and the tests without relying on
conditionals.

By default, all symbols are now hidden unless annotated as public.
Internal symbols are explicitly marked as not being exported in case
users chose not to hide symbols by default.

Change-Id: I589dd10be2f6f438508783cf99d141af0120057b
2022-02-14 20:19:08 +01:00
Sergiu Deitsch 484d3414e4 Replace virtual keyword by override
virtual can be ambiguous. Applied changes correspond to clang-tidy fixes
stemming from the modernize-use-override check.

Change-Id: I973afd4680a5df587419777504aeb94467196b89
2022-02-09 00:34:05 +01: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
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 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 e82e128344 Deprecate integral_types.h
This header defined integral types in the pre-C++11 days, and can
be replaced with <cstdint> and the types defined therein.

Also remove a shallow (and incorrect) typedef in include/ceres/types.h

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

Change-Id: I398c652f74d24bbeea459672508bf28f591b100f
2018-08-09 12:17:05 -07:00
Sameer Agarwal 31f24521cc Deprecate macros.h and fpclassify.h
1. Replace CERES_DISALLOW_* with explicitly deleted constructors.
2. Replace use of CERES_ARRAY_SIZE and stack allocated arrays
   with std::vector.
3. Move CERES_ALIGN_* macros into manual_constructor.h, which is
   the one place they are used and will be deprecated along with that
   file.
4. Introduce isnan,isnormal,isinf and isfinite for Jets.
5. Replace IsNormal,IsFinite,IsNaN and IsInfinite with corresponding
   c++11 function calls.

Change-Id: I04f33a221aae77d247602150988b6d4aa4efeeab
2018-04-18 09:54:42 -07:00
Sameer Agarwal e49507cbea More C++ification.
"> >" -> ">>"
"> > >" -> ">>>"

Change-Id: Id1ddd9dbf030fe21d57207741b4ca8403068e55b
2018-04-03 10:58:15 -07:00
Keir Mierle 7c4e8a454e Replace scoped_ptr with C++11's unique_ptr
Change-Id: Ib5a504c491e3a79af52a95accf009df473470c6b
2018-04-02 14:47:47 -07:00
Sameer Agarwal fc9336e12a Deprecate mutex.h
Use C++11's std::mutex and std::lock_guard instead.

Change-Id: If8d513d5d8f2ee2a49c1ebb249ffa93e4a80086b
2018-04-02 06:03:06 -07:00
Sameer Agarwal a1458f3348 More C++11ification.
1. Replace HashMap and HashSet with std::unordered_map and
   std::unordered_set respectively.
2. Extract the pair hasher into a struct pair_hash.
3. Delete collections_port.h
4. Convert explicit iterator based loops to auto based
   loops where sensible.

Change-Id: Ib88bcd13a7463d18435639d3b771abaa52080efb
2018-03-30 12:03:28 -07:00
Keir Mierle 7492b0d8de Update copyright headers with new year and URL
Since Ceres is moving to using GitHub for issues, and the Google
Code URL in the current copyright header will soon become invalid,
update all the headers.

Change-Id: I1fce70375d1bcf098591f07b4d8f01a5c1e0789c
2015-03-18 05:43:23 +00:00
Sameer Agarwal bcc865f81c Remove using namespace std;
For historical reasons we had a "using namespace std;" in port.h. This
is generally a bad idea. So removing it and along the way doing a bunch
of cpplint cleanup.

Change-Id: Ia125601a55ae62695e247fb0250df4c6f86c46c6
2015-01-07 14:26:53 -08:00
Sameer Agarwal 9e11cd16d0 Faster BlockRandomAccessSparseMatrix::SymmetricRightMultiply.
Trade a small amount of memory to improve the cache coherency of
the SymmetricRightMultiply operation.

The resulting code leads to a 10-20% speedup in the linear solver
end to end.

Change-Id: I8ab2fe152099e849b211b5b19e4ef9f03d8e7f1c
2014-09-29 15:50:19 -07:00
Sameer Agarwal c99872d48e Add BlockRandomAccessSparseMatrix::SymmetricRightMultiply.
Change-Id: Ib06a22a209b4c985ba218162dfb6bf46bd93169e
2014-09-24 21:34:53 -07:00
Sameer Agarwal 0e2743e24d Add BlockRandomAccessDiagonalMatrix.
This class is used in the SchurJacobiPreconditioner for
storing the preconditioner matrix. Using it speeds up
the computation of the preconditioner by ~15% due to
the elimination of a hash table lookup.

Change-Id: Iba2b34aad0d9eb9bcb7f6e6fad16aa416aac0d2a
2013-10-24 19:40:38 +00:00
Sameer Agarwal b99550dc9a Add BlockRandomAccessCRSMatrix.
Change-Id: I4b88402e2216c6ea2728472e2f89479d368dbd4b
2013-05-19 12:47:48 -07:00
Sameer Agarwal 58ad13c05d BlockRandomAccessSparseMatrix::IntPairToLong suffers from integer
overflow.

Even though the return value of this function is a long int, the
computation happens with three ints, which causes an overflow before
the upgrade happens.

The fix is to upgrade the constant used int his computation to be a
long int, which causes the computation to be done in longs instead of
ints.

A test has been added to verify that the fix works.

Change-Id: Ibb0aef877125bb37ca28754cb07b8e1627fd1d5a
2012-06-05 18:06:00 -07:00
Sameer Agarwal 237d659b8d Added CERES_ prefix to the DISALLOW macros.
Change-Id: Ib81e9112e8bbc6ed6cb52f21825df0f6e659be51
2012-05-30 21:50:32 -07:00
Keir Mierle 8ebb073038 Initial commit of Ceres Solver. 2012-04-30 23:09:08 -07:00