Also
1. Remove an inadvertent LOG(INFO) from trust_region_minimizer.cc
2. Refactor some of the code in FullReport to reduce duplication
across line search and trust region minimizers.
3. Consistent capitalization.
Change-Id: I9078b1704efab23d2858530636f524e60c7d9016
Remove the Eigen temporary by revealing the columnwise nature
of the computation. This also allows us to get rid of the
special case for nrow = 1.
On problem-356-226730-pre.txt with -robustify evaluation times
change from:
Before:
Residual Evaluations 1.015
Jacobian Evaluations 18.313
After:
Residual Evaluations 1.005
Jacobian Evaluations 8.382
To give a sense of the overhead reduction, compare these numbers
when loss functions are disabled.
Residual Evaluations 0.955
Jacobian Evaluations 7.772
So, this is a 17.5x speedup!
The one dimensional specialization was motivated by denoising.cc.
The evaluation times there are essentially unchanged.
Before:
Residual Evaluations 2.774
Jacobian Evaluations 20.178
After:
Residual Evaluations 2.588
Jacobian Evaluations 19.781
Change-Id: Ic0efbaed75fe4489635039f17189ae24b97802c8
This allows CovarianceImpl to be forward declared without
scoped_ptr freaking out.
Thanks to Nima Keivan for reporting this.
Change-Id: Icd5aa766b3aab70246055225231a4b971c6b7b90
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
This introduces a simple C API for a subset of Ceres. This opens the door to
using languages like Python to call Ceres, since it is much easier to bind to C
than it is to bind to C++. It will mean giving up the native Ceres autodiff.
The implementation in this patch does not attempt to do everything but is only
just enough to get started. Subsequent patches will increase the surface area
of Ceres that is covered by the C API.
Change-Id: Ic51804bac6865e1a2e476553248aabc91dff3409
The schur ordering is used to construct an elimination
ordering for Schur type solvers when the user has not
supplied an elimination ordering.
The ordering algorithm does an ordered traversal of the
sparsity graph of the Hessian. The order in which this is
done used to be determined by the degree of the parameter
blocks with ties broken arbitrarily using the memory address
of the parameter blocks.
This introduced non-determinism in the solver, causing subtle
numerical differences in the value of the solution everytime
the solve was run.
This change introduces ComputeStableSchurOrdering which utilizes
a new function StableIndependentSetOrdering. The latter takes
as input an ordering of the vertices of the graph which is used
to break ties when ordering the vertice by degree. The former
constructs such an ordering by using the order in which the
parameter blocks were added to the Problem.
In this way, as long as the construction of the problem is
deterministic, the schur ordering will always be deterministic
too.
I have chosen not to delete the existing unstable implementations
of these functions as they are used by the inner iteration
minimizer.
Sometime in the near future I will clean up some of the duplicate
code and see if we can move all the code to using a stable ordering.
Change-Id: I8fbfa240d7307a2c3fe9b135f6968aa410d78780
- The -O4 option requires the linker to have bitcode support, currently for
clang this means using the gold linker and the LLVM-gold plugin:
http://llvm.org/docs/GoldPlugin.html.
- Otherwise you get (confusing) 'file format not recognised' errors ala:
http://llvm.org/bugs/show_bug.cgi?id=9897.
- Adding explicit check for LTO support as at least some package installs of
clang on linux do not use the gold linker by default.
Change-Id: I2a4c670e470d9b48da2a15b7e91a59fb4ad3e8ad
1. Bug fix in NumericDiffCostFunction (Thanks to Nicolas Brodu).
2. Minor documentation update in solver.h
3. Version history update.
4. Bump the version and ABI version.
Change-Id: I951574ddd0b2c4c03b9c79ff33eb9bea549071e7
1. CX_SPARSE supports pre-ordering of the jacobian.
2. Add support for constrained approximate minimum degree ordering
for SuiteSparse versions >= 4.2.0
3. Using 2, support for pre-ordering for SPARSE_SCHUR when used
with SUITE_SPARSE.
4. Using 2, support for user orderings in SPARSE_NORMAL_CHOLESKY.
5. Minor cleanups in documentation and code all around.
6. Test update and refactoring.
Change-Id: Ibfe3ac95d59d54ab14d1d60a07f767688070f29f
Uptil now only SuiteSparse when used with SPARSE_SCHUR would use
the block structure of the reduced camera matrix to find a fill-reducing
ordering.
This leads to substantial speedup for some bundle adjustment
problems.
Credit for this technique goes to the authors of g2o. I learned
about it from reading their source code.
Change-Id: I5403efefd4d9552c9c6fc6e02a65498bdf171584
Evaluator now uses custom BLAS for gradient
computations.
Update the evaluator in trust_region_minimizer_test to compute
gradients.
Change-Id: I3f565bc203b47b2b795a0609d67f25775648653c
Sparse Cholesky factorization algorithms use a fill-reducing
ordering to permute the columns of the Jacobian matrix. There
are two ways of doing this.
1. Compute the Jacobian matrix in some order and then have the
factorization algorithm permute the columns of the Jacobian.
2. Compute the Jacobian with its columns already permuted.
The first option incurs a significant memory penalty. The
factorization algorithm has to make a copy of the permuted
Jacobian matrix.
Starting with this change Ceres pre-permutes the columns of the
Jacobian matrix and generally speaking, there is no performance
penalty for doing so.
In some rare cases, it is worth using a more complicated
reordering algorithm which has slightly better runtime
performance at the expense of an extra copy of the Jacobian
matrix. Setting Solver::Options::use_postordering to true
enables this tradeoff.
This change also removes Solver::Options::use_block_amd
as an option. All matrices are ordered using their block
structure. The ability to order them by their scalar
sparsity structure has been removed.
Here is what performance on looks like on some BAL problems.
Memory
======
HEAD pre-ordering
16-22106 137957376.0 113516544.0
49-7776 56688640.0 46628864.0
245-198739 1718005760.0 1383550976.0
257-65132 387715072.0 319512576.0
356-226730 2014826496.0 1626087424.0
744-543562 4903358464.0 3957878784.0
1024-110968 968626176.0 822071296.0
Time
====
HEAD pre-ordering
16-22106 3.8 3.7
49-7776 1.9 1.8
245-198739 82.6 81.9
257-65132 14.0 13.4
356-226730 98.8 95.8
744-543562 325.2 301.6
1024-110968 42.1 37.1
Change-Id: I6b2e25f3fed7310f88905386a7898ac94d37467e
This will allow CHOLMOD to compute the sparse
Cholesky factorization of J'J without making
a permuted copy of it.
Change-Id: I25d0e18f5957ab7fdce15c543234bb2f09db482e
Break up CreateReducedProgram into smaller functions in
preparation for more sophisticated ordering strategies.
Change-Id: Ic3897522574fde770646d747fe383f5dbd7a6619
1. CreateSparseMatrixTransposeView now returns a struct instead
of a pointer.
2. Add AnalyzeCholeskyWithNaturalOrdering.
Change-Id: If27a5502949c3994edd95be0d25ec7a0d1fa1ae1
This was accidentally an int, which was setting the minimum
trust region radius to zero and effectively disabling a convergence
test based on it.
(Thanks to Sergey Sharybin for providing a reproduction for this)
Change-Id: Id0b9e246bcfee074954a5dc6a3a2342adab56c16