- This should no longer be required on newer (3.5+) CMake versions and
breaks the detection of supplementary compiler feature information
such as the population of CMAKE_CXX_COMPILE_FEATURES which is required
in order to compile Ceres.
Change-Id: Ibceab545925aa1e829320efa03fb74ef149cbb8b
SuiteSparseQR sets permutation to NULL when the permutation is the
identity. Thus, instead of checking that permutation is not NULL, we
handle that case when building the inverse_permutation.
Change-Id: Ib0fcdf3462da765ac0d4b7aee47a1dff7b3a6c53
std::random_shuffle() is deprecated since C++14 and was removed in
C++17. At least MSVC with C++17 fails to compile this code, I assume
other compilers fail as well.
In a Github discussion (#373) Sameer Agarwal states this line can
likely be dropped and asks for a PR/CL.
https://github.com/ceres-solver/ceres-solver/issues/373
Change-Id: I78e04f36cba398769b8f90916edbdaf33884e7e1
CLUSTER_JACOBI and CLUSTER_TRIDIAGONAL preconditioners require a sparse
Cholesky factorization library. Previously this code was hard coded to
use SuiteSparse. Once SparseCholesky abstraction was introduced, it
became possible to use it with Eigen or CXSParse.
Unfortunately the old code path that was enforcing the requirement
of SuiteSparse was not removed.
This change does the following:
1. Remove the SUITE_SPARSE restriction on CLUSTER_TRIDIAGONAL and
CLUSTER_JACOBI
2. Redo the checking code to be ifdef free and more general.
3. Add bundle adjustment tests to test these configurations.
Thanks to Bjorn Piltz for catching and reporting this bug.
Change-Id: I637791f6f8149694b6aa75f6a4b6417398cb9590
- When Ceres was configured without any multithreading enabled (actually
the default) it would fail to build due to undefined symbols for
ParallelFor() as there was no implementation for that case.
- This adds a trivial single-threaded implementation for that case,
taken from the C++11 threads implementation.
Change-Id: Ib3cfd620842b09f1acafe95b8b0ba3aee4587581
1. Use using directive to pull functions from the std:: namespace
instead of defining a forwarding function.
2. Remove Eigen 2.0 related definitions.
Change-Id: If5f24ef740c17bc4db300fa04f4a2e8f809970d2
Also removed Solver::Summary::num_linear_solver_threads_given
and Solver::Summary::num_linear_solver_threads_used.
Change-Id: I559145ae2e7af597ea06ec03d386645a3a892e9f
Due to the large amount of changes made as part of
the C++11 migration, it makes sense to have a
large version bump.
Change-Id: I2d81828e2d8e23f0829070726e7b3ec31d7f1724
This was currently buried in port.h. Since there is exactly one use
of the max_align_t handling, it is better from a readability
and cleanliness perspective to have this in jet.h.
Change-Id: I2f3dde75df7c333bd95393b9e4fc4cd5160d6afb
- As OPENMP, TBB & CXX11_THREADS are mutually exclusive, and their
implementations are wholly contained within enclosing #ifdefs if the
requisite option is not enabled then the source file is 'empty'.
- This triggers 'xxx.cc has no symbol' warnings when compiling
Ceres statically, as such we now only include these files if they are
not going to be empty.
Change-Id: I5390251b44c5770bbdd4ccb1bc916dbe3b1814a9
The way the SystemTest fixture works is that it takes
a "FooProblem" object as a type, which contains a ceres::Problem
and a ceres::Solver::Options object.
The Options object also contains a linear_solver_ordering which
contains double* which refer to memory that is allocated when
a problem object is created.
So it is important that the lifetime of the ceres::Problem object
and the ceres::Solver::Options object be tied together. But we were
violating this by creating a FooProblem object on the stack, grabbing
its Options struct and passing it to the SystemTest fixture, which
would then create another instance of FooProblem, grab its Problem
object and copy the modified options struct into it.
In the case where a user provided ordering was being used,
this ordering would now be referring to memory allocated by the first
FooProblem object, which would cause Ceres's internal ApplyOrdering
function to fail.
The fix is ofcourse to Problem and Options object that are born
together.
Change-Id: I07c377a9d5fcabbb6c7ca8aa3460206ce045ffa9
1. Remove SolverConfig, this was a wrapper
around Solver::Options. As we experiment
with more Solver::Options, it became a hurdle.
2. Updated generate_bundle_adjustment_tests.py to use
Solver::Options directly.
3. Update system_test to use Solver::Options.
NOTE: generate_bundle_adjustment_tests.py changes are a bit
gunky, but I tried to minimize the changes in this CL
as I am going to introduce new test cases and that
is going to significantly change this file.
Change-Id: I34a2f51824b04ef368a5bbe54fbd7b281381909e
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
Change the loop structure of IterativeRefiner to
unconditionally refine for max_num_iterations.
This is done for two reasons.
1. We expect to use this refinement for a small number of iterations
where the convergence test is useless.
2. Eliminating the convergence test means we can restructure the loop
and save on a sparse matrix-vector multiply, saving precious
compute.
Change-Id: I6347f453a5d19d234af2a2eb1bce811048963e06
1. Add Solver::Options::use_mixed_precision_solves,
and Solver::Options::max_num_refinement_iterations.
2. Make SparseCholesky::Create return a unique_ptr.
3. SparseCholesky::Create now takes LinearSolver::Options
as an argument.
4. IterativeRefiner's constructor does not require num_cols
as an argument.
5. SparseNormalCholeskySolver now uses a separate rhs vector.
This basic implementation results in a 10% reduction in solver time
and 30% reduction in linear solver memory usage.
Change-Id: I6830f32cae2febf082d2733262eb2c9f0482b0ea
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
1. Remove defines which are not used anymore.
2. Enable CXX11 threading.
3. Enable EIGEN_SPARSE by default.
Change-Id: I841ba517367e6b204475e5255c91313f01a5bcdb
With the addition of C++11 support we can simplify the parallel for code by
removing the ifdef branching. Converts coordinate_descent_minimizer.cc to use
the thread_id ParallelFor API.
Tested by building with OpenMP, C++11 threads, TBB, and no threads. All tests
pass.
Also compared timing via the bundle adjuster.
./bin/bundle_adjuster --input=../problem-744-543562-pre.txt
With OpenMP num_threads=8
Head:
Time (in seconds):
Residual only evaluation 0.807753 (5)
Jacobian & residual evaluation 4.489404 (6)
Linear solver 41.826481 (5)
Minimizer 50.745857
Total 73.294424
CL:
Time (in seconds):
Residual only evaluation 0.970483 (5)
Jacobian & residual evaluation 4.647438 (6)
Linear solver 41.781892 (5)
Minimizer 50.848904
Total 73.089983
With OpenMP num_threads=1
HEAD:
Time (in seconds):
Residual only evaluation 2.990246 (5)
Jacobian & residual evaluation 14.132090 (6)
Linear solver 79.631951 (5)
Minimizer 100.281847
Total 122.946267
CL:
Time (in seconds):
Residual only evaluation 3.075178 (5)
Jacobian & residual evaluation 13.966451 (6)
Linear solver 77.005441 (5)
Minimizer 97.568712
Total 120.410454
Change-Id: I1857d7943073be7465b6c6476bf46ab11c5475a3
1. Add explicit tests for MatrixMatrixMultiplyNaive and
MatrixTransposeMatrixMultiplyNaive
2. Add tests that exercise a variety of matrix sizes for
MatrixVectorMultiply and MatrixTransposeVectorMultiply.
Change-Id: I0b25ec346b719f19b2067848f9d4bb64c9848750
Migrate all Option and Summary structs to use
inline member initialization syntax.
This reduces the amount of code, and collocates the
default values with the documentation for the corresponding
member variable.
Change-Id: I8e6b9ee3b31464699d678667f6166ace5fc137c9
- Previously we were requesting a step-size which minimised the
polynomial in: [previous.x, current.x * factor].
- This is incorrect c/f Nocedal & Wright p60, the bounds for the
minimising step-size should be: [current.x, current.x * factor].
- However, Nocedal & Wright's bounds are insufficient when the function
can return invalid values, which we support.
- In the case that f(current) is invalid, we need to contract the
step-size to lie within: [previous.x, current.x) given that we know
that previous.x is valid so a valid step must exist within that range.
Change-Id: I67b5aaa09cc6d54cf5f264e2cf894ddc2af3f3ad
- In practice, this was not causing any errors, as
GFLAGS_INCLUDE_DIR_HINTS is set from GFLAGS_INCLUDE_DIRS so the two
would have been equivalent, but we should nonetheless be using the
one set after the find_package() call.
- Note that this would only have been active for older gflags versions
that were not built with CMake.
Change-Id: Ie54145f522c974b7685052aafb1d2f6055d22337
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
- Removes CXX11 option, and all associate paraphernalia. Ceres now
requires a compiler with full >= C++11 support. In MSVC terms this
means >= 2013 Release 4.
- This deprecates the use of CERES_STD_UNORDERED_MAP and CERES_USE_CXX11
as they will now always be defined. They will be removed from the
source in a future CL.
- For clients with CMake >= 3.8 we propagate via the exported/installed
Ceres target the CXX version that was specified when Ceres was built.
For versions < 3.8 (but >= 3.5) we specify the CXX features currently
used in the Ceres public API.
Change-Id: I535b545b10156e4426659c270a4a0649e071df0e
Even though we added support for storing the upper and
lower triangular parts of symmetric matrices in
CompressedRowSparseMatrix. RightMultiply, LeftMultiply
and SquaredColumnNorm were not modified to account for this.
This CL changes their implementation and adds thorough
tests.
Also methods that cannot work correctly with symmetric
storage now CHECK and fail, because that indicates
programmer error.
Change-Id: I76288472c8bac98db7376a79bdb6259e346ef2b7