This is a preliminary, but full, port of Ceres to Windows.
Currently all tests compile and run, with only system_test
failing to work correctly due to a path issue.
Change-Id: I4152c1588bf51ffd7f4d9401ef9759f5d28c299c
Ceres has traditionally battled with portability issues
when trying to classify floating point values as one
type or another. For example, in C99 'isnan' is a
macro. Since it is a macro, it is impossible to
override the name in other namespaces.
Instead of trying to use preprocessor hacks to work
around the issue, define our own set of camel-case
names for use internally and by Ceres clients. For
example do this:
template<typename T>
void MyFunction(T x, T y) {
if (ceres::IsNaN(x)) {
...
}
}
instead of using "isnan" or "std::isnan". Note that
while GCC and Apple GCC both import 'isnan' into
the std namespace, it is not standard until C++11
which Ceres will not require for some years.
Change-Id: Ibcc96a8bb4ba63aa67cbbc58658b2e5671cd5824
Added EIGEN_MAKE_ALIGNED_OPERATOR_NEW to the struct so that
the Jet members are aligned. This fixes an eigen assert in
autodiff_test reported by multiple Ceres users.
Thanks Koichi Akabe & Stephan Kassemeyer
Change-Id: Id3574e926deffa57d205dddaa9d08389b5dc33a8
The hello world example, quadratic.cc and its description
in the tutorial were out of sync and led to some confusion
about the convergence behaviour. This change fixes the tex
file to match the code and discusses whats actually going
on when determining convergence.
Thanks to Nick Lewycky for reporting this.
Change-Id: Ic301d854c3f3d11e37a252e0832c00fb9e3a307c
This fixes the bug introduced in a previous commit,
and adds a test to check that constant parameter
blocks work as expected.
This also refactors the Solver/SolverImpl split so
that SolverImpl is no longer a friend of Problem;
instead, Solver is. This makes it possible to
verify the invariant on parameter block states in
the unit test, and is a more symmetric design
anyway.
Bug: 51
Change-Id: Id503f5b526cfb8bc24aae3aaad2e414b14063d78
1. Termination type was using == instead of =.
2. LevenbergMarquardtStrategyTest was using an object
which was not returning the correct value.
3. DumpLinearLeastSquaresProblemToTextFile was passing an
unnecessary argument to StringAppendF.
Change-Id: Ie7598c8e3d504763c889737a0d5cec805d52bbaf
1. Test that reproduces the failure on macos.
2. Move the alignment macros from manual_constructor.h
to macros.h and rename them to prevent conflicts.
3. The inline array used by FixedArray is now aligned.
4. Jet has been modified to be eigen friendly.
Change-Id: I4563847a767a92156dabab1ab420f0cdddb8ba77
User callbacks got broken at some point due to the extra
layer of copying from Solver::Options to Minimizer::Options.
This copies the user callbacks when initializing
Minimizer::Options from Solver::Options, and adds a test to
this effect.
This also fixes a bug where the state updating callback was
not called before the user callbacks. This also adds a test
to solver_impl_test to ensure the state updating callbacks
work as expected.
Thanks to Luis Alberto Zarrabeitia for the report.
Issue: 46
Change-Id: I2b36415c89dafaa5c84ecaa727a325df122e1092
The SolverImpl::Solve() method incorrectly assumed that the
state pointers inside the parameter blocks always pointed to
the user state at the start of the method. That is not true.
Change-Id: I73f8eeda453422c99e09d71a3cd0bfa92dd45742
1. Document the use of dogleg and a general discussion of
trust region methods.
2. Added a TBD section on compiler/linker flags.
3. Summary::FullReport now prints out sparse_linear_algebra_library
and trust_region_strategy_type.
Change-Id: I01f680070d510715900f345364855689005d54bb
There was a overzealous DCHECK in suitesparse.cc when converting
a scalar matrix into a block matrix. This stemmed from my poor
understanding of how lower_bound works.
The test for this function was not stringent enough, and was
not run in debug mode for this to get triggered. The test
has been updated, it fails without the fix and runs correctly
with it.
Thanks to Markus Moll for reporting this and suggesting the
fix.
Change-Id: Ide6b971fd4c618ef5e240f500f514c4b78d7b6e3
Also a fix for a minor segfault in trust_region_minimizer.cc
which was discovered while writing this test.
Change-Id: I50353d0292fd37495bf73de3824c430912ef221d
1. A new dogleg trust region strategy.
2. Consistent naming of all variables taking and reporting
time. Also all are doubles now.
3. Enum to stringification routines.
4. bundle_adjuster.cc accepts max solver time and trust_region_strategy.
5. Time accounting is pushed into solver_impl.cc and there is now
postprocessing time accounted for explicitly.
6. IterationCallback now has cumulative time.
7. LoggingCallback logs per iteration and cumulative time.
8. TrustRegionStrategy now allows for Invalid steps to be indicated
explicitly.
9. Trust region minimizer actually terminates on max_solver_time.
Change-Id: I7e3b82c8beebc17b6b355ea46ddd280754a2d8b2
SPARSE_NORMAL_CHOLESKY with CXSparse on the fairly small
bundle adjustment problem used in system_test is too expensive
to be useful as a test. It takes up too much memory and time
making the test fail on client computers < 4G of RAM.
These tests have been deleted.
Change-Id: Id015671536afd7013f5b7d19c39d64c2748884ad
Fix broken build and verbosity issues.
1. While cleaning up the last CL, I broke a macro.
2. cholmod_common_print was being called too often.
Change-Id: Ia76d8863c72f31b0c02977094b22035ceef835cf
By virtue of the modeling layer in Ceres being block oriented,
all the matrices used by Ceres are also block oriented.
When doing sparse direct factorization of these matrices, the
fill-reducing ordering algorithms can either be run on the
block or the scalar form of these matrices. Running it on the
block form exposes more of the super-nodal structure of the
matrix to the Cholesky factorization routines. This leads to
substantial gains in factorization performance.
This changelist adds support for approximate minimium degree
orderings to be computed on the block structure of the
Schur complement matrix. This affects, SchurComplementSolver
and VisibilityBasedPreconditioner and SparseNormalCholesky
when using SuiteSparse.
A bool, use_block_amd has been added to Solver::Options and
bundle_adjuster.cc has been updated to allow testing with it.
When combined with a multithreaded Schur elimination, speed ups
can be seen quite uniformly across the board. For some problems
this can be dramatic, reducing the factorization time from 70
seconds down to 17 seconds.
Change-Id: I15ebb0afcbc85ada032ec8d179ee3a2f7c8d3e46
overflow.
Even though the return value of this function is a long int, the
computation happens with three ints, which causes an overflow before
the upgrade happens.
The fix is to upgrade the constant used int his computation to be a
long int, which causes the computation to be done in longs instead of
ints.
A test has been added to verify that the fix works.
Change-Id: Ibb0aef877125bb37ca28754cb07b8e1627fd1d5a
1. New TrustRegionMinimizer and basic tests for it.
2. New TrustRegionStrategy interface.
3. New LevenbergMarquardtStrategy and tests for it.
4. Updates to SolverImpl to reflect this.
5. Changes to Solver::Options and IterationSummary related to this.
6. Deleted levenberg_marquardt.cc/h/_test.cc
Change-Id: I6c1d1a7c774f014856f9f26263a830aa886e1400
1. Split into two parts - Tutorial & Reference.
2. Reference is split into Modeling and Solving.
3. Build instructions now mention CXSparse.
Change-Id: Id67fa1134f3fc2b2cea9ccf2f32d5b16d435ba6e
Updated the value of the version of cmake needed to build
ceres. Since the way booleans and literals are handled has changed
recently.
Change-Id: If13877f4403705cc29c3cf66c4e66dec26bbb3e9
1. Added support for CXSparse - SparseNormalCholesky and
SchurComplementSolver support SuiteSparse and CXSparse now.
I am not sure I will add suport for visibility based
preconditioning using CXSparse. Its not a high priority.
2. New enum SparseLinearAlgebraLibraryType which allows the user
to indicate which sparse linear algebra library should be used.
3. Updated tests for SolverImpl and system_test.
4. Build system changes to automatically detect CXSparse and
link to it by default -- just like SuiteSparse.
5. Minor bug fixes dealing in the cmake files and VBP.
6. Changed the order of the system test.
7. Deduped the unsymmetric linear solver test.
Change-Id: I33252a103c87b722ecb7ed7b5f0ae7fd91249244
StateUpdatingCallback updates the user's parameter blocks in
every iteration if the user so desires. The callback depends
on having access to an array that the minimizer is using internally
to do all the work. This is probably poor design.
As a consequence of this design, it is easy to initialize the
callback with the wrong array, which was the case here. It was
being initialized with the array of initial parameters, which the
minimizer does not touch, rather than the array final_parameters,
which just happens to the one in which the Minimizer does all
the work.
Testing this change is a pain, because nothing is wrong with the
Callback object, but rather the way it was being instantiated by
SolverImpl, and the only way to test would be to test the whole
Solve call.
The reordering code assumed that the parameter_block->index()
field is always set; this is not true. For fixed blocks the index
may have an arbitrary value. This changes the code to ignore fixed
blocks properly.
In some cases the Levenberg-Marquardt can oscillate between,
two values of the regularizer mu. A small value which causes
the linear solver to fail and a higher value at which the solver
makes progress. This can cause significant wastage of solver
effort, and mu should just be clamped to some value.
This CL provides this setting as Solver::Options::min_mu,
and updates the documentation to reflect this.
unnecessarily complexity in the structure of linear solvers and preconditioners.
This is the first step towards cleaning up the Preconditioner interface.
2. Minor tweaks and cleanups to the various linear solvers.