Commit Graph

15 Commits

Author SHA1 Message Date
Sameer Agarwal caf614a6c1 Modernize code using c++17 constructs
Mostly done using

find . \( -name '*.cc' -o -name '*.h' \) -a -type f -exec clang-tidy -p \
cmake-build -checks='-*,google-*,modernize-*,-modernize-use-nodiscard,-modernize-use-trailing-return-type' {} -fix \;

Change-Id: Ifccbcabe7a1d9a32a09d28ac4f3f8466696c1a50
2022-04-22 06:11:18 -07:00
Sameer Agarwal 4705159858 Add missing includes for config.h
covariance.h was using SUITE_SPARSE even when SUITESPARSE
was disabled because it did not have config.h included in it
so it did not see that CERES_NO_SUITESPARSE was defined.

Add more config.h includes to files that are using these
configuration macros.

Change-Id: I6b1d2c2bd9e559de40a6332cd6be85ad4da3377b
2022-03-12 15:55:19 -08:00
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
Sameer Agarwal ae65219e04 ClangTidy cleanups
1. NULL -> nullptr
2. foo.reset(new Bar) -> = foo = std::make_unique<Bar>()
3. Missing std library includes & prefixes

Change-Id: I260b261b484554be681ee5a7398126fdb3b3a789
2022-02-09 10:06:49 -08:00
Sameer Agarwal 123fba61cf Eigen::MappedSparseMatrix -> Eigen::Map<Eigen::SparseMatrix>
Eigen::MappedSparseMatrix has been deprecated and removed from
Eigen at HEAD.

Thanks to rmlarsen@ for fixing this.

Change-Id: I34f3b0dda2bb91ee8cc65a20e53a3d7de6929221
2021-11-21 10:33:23 -08: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
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 83f70e5c02 Remove unnecessary memory allocations when using SuiteSparse.
1. Add SuiteSparse::CreateDenseVectorView
2. Replace calls to SuiteSparse::CreateDenseVector with
   SuiteSparse::CreateDenseVectorView.
2. Replace NULL with nullptr in suitesparse.cc and
   dynamic_sparse_normal_cholesky_solver.cc

Change-Id: I94355c1dc27789e5b987a7b2850e9db6176a0914
2018-04-09 14:39:02 -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 f93ad78f23 Lint changes from William Rucklidge
Change-Id: I54ee9d7b90232bb0139398a78a09cf4035d23ea6
2017-05-31 19:44:23 -07:00
Sameer Agarwal 29c21f5680 Add SparseCholesky
SparseCholesky is an interface to sparse cholesky factorization
routines across sparse linear algebra libraries. Each sparse
linear algebra library is responsible for implementing its own
instance of this interface.

As a result the various places - SparseNormalCholeskySolver,
SparseSchurComplementSolver and VisibilityBasedPreconditioner
are significantly simplified.

Change-Id: I8b465705eae83bba9e1adfffcc741a05c70faf2e
2017-05-24 00:00:25 -07:00
Sameer Agarwal d04347af43 Delinting from William Rucklidge.
Change-Id: I1b0243d43d55b6c9cdcda9d4b677ec444928b223
2017-04-13 11:47:01 -07:00
Sameer Agarwal 64a20e7ce2 Remove dead code from CompressedRowSparseMatrix.
SolveLowerTriangularInPlace
SolveLowerTriangularTransposeInPlace

were unused functions which can be removed.

Change-Id: I0fd29c1efae2a0a74666f6e3541473bebc22ae82
2017-04-11 12:10:40 -07:00
Sameer Agarwal 5c2fd0526a Add DynamicSparseNormalCholeskySolver
This code was currently buried under a bool inside SparseNormalCholeskySolver.
Pulling this out in its own solver makes the code simpler more readable
and more performant in the case of SuiteSparse.

Change-Id: I72379ca9ca162abbb83c12f7ee8ff92bc71e772c
2017-04-11 11:55:43 -07:00