- SuiteSparse_config (SuiteSparse >= 4.0) requires librt if compiled
with timing support, which is the default on Linux & Unix (except
OSX).
- This was previously raised as issue 124:
https://code.google.com/p/ceres-solver/issues/detail?id=124.
Change-Id: I08ada41cd28d2e63a4bf342e143e23fe8213e9ee
This brings the ability to have numerically differentiated
cost functions to be added with its structure decided on
runtime rather than compile time.
And some minor cleanups.
Two things still need to be done.
a. Update the modeling docs.
b. Remove RuntimeNumericDiffCostFunction in ceres::internal
and replace its usage with DynamicNumericDiffCostFunction.
Change-Id: Ib771f093f29236c95a99df31c584d579b8e36615
1. Update AutoDiffCostFunction template parameters to be consistent
with NumericDiffCostFunction.
2. Update the documentation for NumericDiffCostFunction and
AutoDiffCostFunction.
Change-Id: I113038abb5bedebb0f6f326f2a4ac31480d785fc
- Older versions of Clang (<= 2.9 - [which was shipped with Ubuntu
11.10]) do not support return-type-c-linkage option and thus aborted
compilation.
Change-Id: Ifc76db6e5d525c98bebfa579116672b3b0e04387
The indexing parameter in the parameter block is expected
to be the same as its position in the program. However,
when Solve is called, the parameter blocks are made
members of a new program and the same indexing parameter
is used to store the position of the parameter block
in this new reordered program.
So when the user calls RemoveParameterBlock after calling
Solve, and ProblemImpl checks the invariant on the
indexing parameter it does not match and causes a crash.
The fix is to make sure that before returning from Solve,
the state of the indexing parameter's values are restored
to their original values corresponding to their positions
in the Program object contained in the ProblemImpl object.
Thanks to Simon Lynen for reporting this.
Change-Id: I060745026cd23a688c1fb5e2c9e6053e9ba1c78f
directly from eigen expressions, instead of creating a temporary). Also
changed several variable names from temp to tmp to be consistent with
the code base.
Change-Id: I3f7b834cedca9c4af8e5e086237b40301dbde619
1. Not set -march=native -mtune=native for GCC versions less than 4.2
2. Explicit cast in lapack.cc
Thanks to Dustin Lang for reporting this.
Change-Id: I71fbefa5f7db0188516f9f1dc044d7d5f374e2cd
Add Minimizer::Options::is_silent which allows the user
to turn off the logging inside the minimizer completely.
In particularly this is used for silencing the logging
when inner iterations are used.
Add VLOG_IF to miniglog.
Change-Id: I4dc56e726eb012b4bbf750dc92adedba1a6d9c38
LocalParameterization::Plus is allowed to return false when for some
reason the operation cannot be performed. Uptil now, this would
cause the TrustRegionMinimizer to terminate with a numerical failure.
This is not correct behaviour. Just like CostFunction::Evaluate,
returning false from LocalParameterization::Plus should result
in the current step to be rejected rather than the entire optimization
coming to a halt.
LineSearchMinimizer has also been updated to use the same pattern.
Thanks to Michael Vitus for reporting this.
Change-Id: I1351966bc6db3bf6cd46387b78d4e52a9df51696
build_android.sh is broken and fixing it seems not be worth it.
Especially since building on android is already well supported
using ndk-build.
build_android.sh is also dependent on android-cmake, which is
recently has been a flakey dependency.
Change-Id: I8a22e6e2ef7f1708cd23bd38e33eb17189666509
When the Schur complement is of size zero,
i.e. none of the parameter blocks interact
with each other, the ITERATIVE_SCHUR linear
solver crashes due to some checks that are
triggered in the SCHUR_JACOBI preconditioner.
This patch adds logic to detect this condition
and to deal with it and adds tests that verify
the fix.
Thanks to Soohyun Bae for reporting this bug.
Change-Id: If29ddf32463cbb1960414fff0e29bbf0d2ee7989
1. Use CMake FindLAPACK and FindBLAS Modules.
2. Remove SEARCH_HEADERS and SEARCH_LIBS and replace them with
CMAKE variables. This leads to simplification of the FIND_LIBRARY
and FIND_PATH calls.
3. Make miniglog a fallback when glog is not present and the
user indicates MINIGLOG=OFF.
4. Add time.h to miniglog.
5. Remove shared library building.
Change-Id: I8a97156d3d7cf645fbbfe8e571761bc16c89f43f
CAMD requires that the id of the largest numbered elimination
group be less than the number of columns in the matrix.
This patch ensures that this is the case. Without this,
in certain cases its possible for CAMD to silently fail
while doing out of bounds access and then causing Ceres to fail.
Also add some logging about the problem size before and after
the reduced program has been created.
Change-Id: I0ea3c6572a7c29cbbf09afec9ba5b4f4d4b21a9b
trust_region_minimizer.cc now contains a comment that explains
the reasoning behind he inner iteration step acceptance change.
Change-Id: I4eaa69d6bab92c543bba3f119c09f44625d393bd
Normally, in a trust region algorithm the quality of a trust region step
is measured by the ratio
nonlinear_cost_change
r = ---------------------
model_cost_change
All the change in the nonlinear objective is due to the trust region step
so this ratio is a good measure of the quality of the trust region radius.
However, when inner iterations are being used, nonlinear_cost_change
includes the contribution of the inner iterations and its not fair to
credit it all to the trust region algorithm. So we change the ratio to be
nonlinear_cost_change
r = ------------------------------------------------
(model_cost_change + inner_iteration_cost_change)
In most cases this is fine, but it can be the case that the
change in solution quality due to inner iterations is so large
and the trust region step is so bad, that this ratio can become
quite small.
This can cause the trust region loop to reject this step.
This change, fixes this problem by looking at the inner_iteration_cost_change
explicitly and accepting a step if the inner iterations led to a net
decrease in the objective function value.
Along the way it also fixes the way model_cost_change is computed.
Changing to a more numerically robust way of computing it.
The last and final change is to ensure that inner iterations and the
non-monotonic version of the trust region algorithm interact correctly.
This addresses part 2 of
https://code.google.com/p/ceres-solver/issues/detail?id=115
As an illustration of the change.
Before this change
[master] build: ./bin/bundle_adjuster --input ~/Downloads/problem-245-198739-pre.txt -num_iterations 10 -translation_sigma 0.01 -rotation_sigma 0.001 -point_sigma 0.1 -inner_iterations -num_threads 4
0: f: 7.731660e+15 d: 0.00e+00 g: 3.51e+12 h: 0.00e+00 rho: 0.00e+00 mu: 1.00e+04 li: 0 it: 5.87e-01 tt: 9.37e+00
1: f: 7.731660e+15 d: 7.73e+15 g: 0.00e+00 h: 1.20e+10 rho: 2.43e-11 mu: 5.00e+03 li: 1 it: 1.41e+01 tt: 2.35e+01
2: f: 7.731660e+15 d: 7.73e+15 g: 0.00e+00 h: 1.25e+10 rho: 1.70e-07 mu: 1.25e+03 li: 1 it: 1.86e+01 tt: 4.22e+01
3: f: 7.731660e+15 d:-2.39e+40 g: 0.00e+00 h: 3.53e+10 rho:-2.63e-13 mu: 1.56e+02 li: 1 it: 3.35e+01 tt: 7.57e+01
4: f: 7.731660e+15 d:-1.66e+39 g: 0.00e+00 h: 1.21e+11 rho:-6.58e-15 mu: 9.77e+00 li: 1 it: 3.86e+01 tt: 1.14e+02
5: f: 7.731660e+15 d:-3.57e+55 g: 0.00e+00 h: 5.00e+12 rho:-1.89e-14 mu: 3.05e-01 li: 1 it: 3.84e+01 tt: 1.53e+02
6: f: 7.731660e+15 d:-2.26e+35 g: 0.00e+00 h: 3.82e+12 rho:-1.77e-20 mu: 4.77e-03 li: 1 it: 3.45e+01 tt: 1.87e+02
7: f: 7.731660e+15 d:-5.31e+19 g: 0.00e+00 h: 1.22e+11 rho:-9.96e-21 mu: 3.73e-05 li: 1 it: 2.77e+01 tt: 2.15e+02
8: f: 1.784990e+08 d: 7.73e+15 g: 4.13e+07 h: 1.20e+10 rho: 1.00e+00 mu: 1.12e-04 li: 1 it: 1.13e+01 tt: 2.26e+02
9: f: 1.524025e+08 d: 2.61e+07 g: 5.81e+10 h: 2.41e+08 rho: 1.00e+00 mu: 3.35e-04 li: 1 it: 1.13e+01 tt: 2.37e+02
10: f: 1.488524e+08 d: 3.55e+06 g: 2.79e+09 h: 5.01e+08 rho: 1.00e+00 mu: 1.01e-03 li: 1 it: 1.09e+01 tt: 2.48e+02
After this change
[inner] build: ./bin/bundle_adjuster --input ~/Downloads/problem-245-198739-pre.txt -num_iterations 10 -translation_sigma 0.01 -rotation_sigma 0.001 -point_sigma 0.1 -inner_iterations -num_threads 4
0: f: 7.731660e+15 d: 0.00e+00 g: 3.51e+12 h: 0.00e+00 rho: 0.00e+00 mu: 1.00e+04 li: 0 it: 5.66e-01 tt: 9.31e+00
1: f: 5.941477e+09 d: 7.73e+15 g: 1.20e+18 h: 1.20e+10 rho: 2.43e-11 mu: 5.00e+03 li: 1 it: 1.38e+01 tt: 2.32e+01
2: f: 3.341986e+08 d: 5.61e+09 g: 1.42e+14 h: 1.37e+09 rho: 9.38e-08 mu: 2.50e+03 li: 1 it: 1.30e+01 tt: 3.61e+01
3: f: 3.241492e+08 d: 1.00e+07 g: 3.64e+13 h: 8.26e+08 rho: 6.12e-08 mu: 1.25e+03 li: 1 it: 1.15e+01 tt: 4.77e+01
4: f: 3.152280e+08 d: 8.92e+06 g: 2.02e+13 h: 2.95e+08 rho: 1.56e-05 mu: 6.25e+02 li: 1 it: 1.11e+01 tt: 5.88e+01
5: f: 3.078535e+08 d: 7.37e+06 g: 9.72e+12 h: 4.57e+08 rho: 6.55e-09 mu: 3.13e+02 li: 1 it: 1.16e+01 tt: 7.04e+01
6: f: 3.025353e+08 d: 5.32e+06 g: 1.33e+13 h: 2.14e+08 rho: 7.21e-01 mu: 3.42e+02 li: 1 it: 1.14e+01 tt: 8.18e+01
7: f: 2.908298e+08 d: 1.17e+07 g: 5.97e+12 h: 7.25e+08 rho: 5.73e-01 mu: 3.43e+02 li: 1 it: 1.08e+01 tt: 9.26e+01
8: f: 2.803927e+08 d: 1.04e+07 g: 1.07e+12 h: 9.72e+07 rho: 5.27e-01 mu: 3.43e+02 li: 1 it: 1.03e+01 tt: 1.03e+02
9: f: 2.767074e+08 d: 3.69e+06 g: 2.10e+11 h: 7.35e+07 rho: 7.37e-01 mu: 3.84e+02 li: 1 it: 1.03e+01 tt: 1.13e+02
10: f: 2.744282e+08 d: 2.28e+06 g: 2.17e+11 h: 1.23e+08 rho: 3.11e-01 mu: 3.64e+02 li: 1 it: 9.61e+00 tt: 1.23e+02
Change-Id: I7c3b132f7ce62719795bfa489ec2276d0455cc97
When using the SPARSE_QR algorithm, now a Q-less
factorization is used. This results in significantly
less memory usage.
The inversion of the semi-normal equations is now
threaded using openmp. Indeed if one has SuiteSparse
compiled with TBB, then both the factorization
and the inversion are completely threaded.
Change-Id: Ia07591e48e7958d427ef91ff9e67662f6e982c21
Main purpose of this is to make implementation files free from
endless ifdef blocks every time this libraries are needed to be
included. This would hopefully prevent compilation errors in
the future caused by missing ifdef around header include.
This also includes some stubs added to suitesparse/cxsparse
headers to make code even more free from ifdefs.
Change-Id: Ic8554e7df31d8c4751583fe004b99e71b3c9087b
1. When a LAPACK implementation is present, then
DENSE_QR, DENSE_NORMAL_CHOLESKY and DENSE_SCHUR
can use it for doing dense linear algebra operations.
2. The user can switch dense linear algebra libraries
by setting Solver::Options::dense_linear_algebra_library_type.
3. Solver::Options::sparse_linear_algebra_library is now
Solver::Options::sparse_linear_algebra_library_type to be consistent
with all the other enums in Solver::Options.
4. Updated documentation as well as Solver::Summary::FullReport
to reflect these changes.
Change-Id: I5ab930bc15e90906b648bc399b551e6bd5d6498f
colPivHouseholderQR -> householderQR
ldlt -> llt.
The resulting performance differences are significant enough
to justify switching.
LAPACK's dgels routine used for solving linear least squares
problems does not use pivoting either.
Similarly, we are not actually using the fact that the matrix
being factorized can be indefinite when using LDLT factorization, so
its not clear that the performance hit is worth it.
These two changes result in Eigen being able to use blocking
algorithms, which for Cholesky factorization, brings the performance
closer to hardware optimized LAPACK. Similarly for dense QR
factorization, on intel there is a 2x speedup.
Change-Id: I4459ee0fc8eb87d58e2b299dfaa9e656d539dc5e
Covariance implementation file used to unconditionally include
SuiteSparseQR.hpp which caused compilation error in cases you
don't have SuiteSuite installed to the system
Moved the include to #ifdef block.
Change-Id: I3a52c0f81711b2b70ae625fe80b758ecb0817cc6
-fast compiler option is only supported using Apple's GCC packaged with XCode.
Other GCC versions will fail when this flag is enabled. This commit checks the
GCC version on OSX and only enables this flag when < 4.3. Apple's GCC is
currently 4.2.1 and a user is unlikely to install a non-apple version this old
on OSX.
Change-Id: Ifca9149625c065cd16559d7e30c218a322cf79aa
SuiteSparse_long is only defined in recent versions of SuiteSparse
as the index variable type for large matrices. In older versions
UF_long was used. Ubuntu still ships with an older version of
SuiteSparse, so an ifdef is needed to fix the build.
This patch has been tested on mac and on linux with older and
newer versions of SuiteSparse.
Change-Id: I4ada86d7973784a79bde4afec13ce3ca4e8dc225
1. Typo in c_api.h
2. The stream operator for FunctionSample is now in the ceres::internal namespace.
Change-Id: Id927a7a49c47d8903505535749ecca78cd2e83b3