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
- As reported by Chris Sweeney on the mailing list, Eigen 3.2.2
trips various warnings in Eigen/SparseQR when compiling with GCC.
- Following Petter Strandmark's suggestion, Eigen headers are now
treated as system headers, which implicitly suppresses all warnings.
Change-Id: I104e8cb3f00935cefb894089bea827771e0e9fd0
- Previously if options.num_threads > 1 was given to Covariance compiled
without OpenMP, a CHECK() would be triggered in program_evalutor.
Change-Id: Iaade4f5ed5326b0c59a7014c750c41ee026e1124
- Warning type generated is unused-but-set-variable, not unused-variable
and the corresponding "local variable is initialized but not
referenced" MSVC warning.
Change-Id: I716fd6a87cc91533bc862b2ef932601c8857818d
- Eigen 3.2.0 emits an unused variable warning from Ordering.h
#included by Eigen/SparseQR which prevents Ceres compilation due
to -Werror.
- As Eigen 3.2.0 is still in widespread use, we explicitly disable
the warning only around the inclusion of Eigen/SparseQR.
Change-Id: I48ce905ef6a22bc1b06f9e5bed328bd315f407f0
Sparse Cholesky factorization is not rank revealing. Therefore
this algorithm cannot reliably tell when the Jacobian matrix is
rank deficient or so poorly conditioned that the covariance matrix
cannot be estimated.
Making things worse, this algorithm works on the normal equations,
which makes the conditioning problem much worse.
This change, deletes the SPARSE_CHOLESKY algorithm in the covariance
estimation code. Also to make the naming consistent, it renames
SPARSE_QR -> SUITE_SPARSE_QR
so that it parallels EIGEN_SPARSE_QR.
Also, since we now have EIGEN_SPARSE_QR, we can default to using
it when SuiteSparse is not available instead of DENSE_SVD, which
generally speaking should only be used by folks who are dealing
with small rank deficient jacobians.
Change-Id: I8b134c7e8a2e86ca374371f185b19f1c3e74349c
For smaller problems Eigen is faster than SuiteSparseQR. This has been
tested with Eigen 3.2.1. Below are detailed timings. Problem 1 is the
smallest and problem 3 is the largest. The timings below are:
mean +- standard deviation.
Problem 1:
Eigen 0.0009218 +- 0.0002755
SuiteSparse 0.001406 +- 0.001610
Problem 2:
Eigen 0.002338 +- 0.001005
SuiteSparse 0.001910 +- 0.0004513
Problem 3:
Eigen 0.005455 +- 0.001759
SuiteSparse 0.002411 +- 0.0004974
Detailed problem descriptions:
Problem 1 size:
Original Reduced
Parameter blocks 533 54
Parameters 368 104
Effective parameters 1201 94
Residual blocks 233 77
Residual 1194 258
Problem 2 size:
Original Reduced
Parameter blocks 573 84
Parameters 1458 184
Effective parameters 1281 164
Residual blocks 263 107
Residual 1314 378
Problem 3 size:
Original Reduced
Parameter blocks 613 114
Parameters 1548 264
Effective parameters 1361 234
Residual blocks 293 137
Residual 1434 498
Change-Id: I884a67e2f728fe2992812148d82ccf5f27864fd7
A lot of error checking cruft has accumulated over the years
in the various linear solvers. This change makes the error reporting
more robust and consistent across the various solvers.
Preconditioners are not covered by this change and will be the
subject of a future change.
Change-Id: Ibeb2572a1e67758953dde8d12e3abc6d1df9052d
1. Move LinearSolverTerminationType to ceres::internal.
2. Add FATAL_ERROR as a new enum to LinearSolverTerminationType.
3. Pipe SuiteSparse errors via a LinearSolverTerminationType so
to distinguish between fatal and non-fatal errors.
4. Update levenberg marquardt and dogleg strategies to deal
with FATAL_ERROR.
5. Update trust_region_minimizer to terminate when FATAL_ERROR
is encountered.
6. Remove SuiteSparse::SolveCholesky as it screws up the error
handling.
7. Fix all clients calling SuiteSparse to handle the result of
SuiteSparse::Cholesky correctly.
8. Remove fatal failures in SuiteSparse when symbolic factorization
fails.
9. Fix all clients of SuiteSparse to deal with null symbolic factors.
This is a temporary fix to deal with some production problems. A more
extensive cleanup and testing regime will be put in place in a
subsequent CL.
Change-Id: I1f60d539799dd95db7ecc340911e261fa4824f92
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
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
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
Issue was caused by declaring class PerThreadContext with some
members of choldmod-specific types. This class in only used from
an #ifndef CERES_NO_SUITESPARSE block and solved compilation error
by simply wrapping PerThreadContext with the same #ifndef block.
Change-Id: Icdc329073fcbd4a328e41ea8c0af0962e9c34ba8
1. Multithread the inversion of J'J.
2. Simplify the dense rank truncation loop.
3. Minor correction to building documentation.
Change-Id: Ide932811c0f28dc6c253809339fb2caa083865b5
1. Sparse covariance estimation now uses cholmod_rcond to
detect singular Jacobians.
2. Dense covariance estimation now uses relative magnitude
of singular/eigen values to compute the pseudoinverse.
3. Truncation logic is now unified with Solver::Options::null_space_rank.
Change-Id: I095bd737510c836b4251255926190a7f31d64bce
Add a Covariance object to the API.
Given a Problem object and a set of parameter block pairs the
Covariance object computes a sparse covariance matrix corresponding
to those block pairs and provides random access to them.
Constant parameter blocks and parameter blocks with local parameterizations
are correctly handled.
Sparse and dense implementations are provided. With the dense implementation
rank deficient Jacobians can also be handled.
Parts of the code are threaded using OpenMP if available.
Change-Id: I5b49583b3d79579df3e0f334c22567acb23ed4ad