Fix variable names in port.h and fix fpclassify when
using gnustl. This was tested by switching to gnustl
in the JNI build.
Thanks to Carlos Hernandez for suggesting the gnustl fixes.
Change-Id: I690b73caf495ccc79061f45288e416da1604cc72
By default shared_ptr is now assumed to be
in the standard <memory> header and in the
std namespace.
Previously the way the ifdefs were structured if the appropriate
variable was not defined, it would default to <t1/memory>.
The new defaults are more future proof.
Change-Id: If457806191196be2b6425b8289ea7a3488a27445
Solver::Options::linear_solver_ordering and
Solver::Options::inner_iteration_ordering
were bare pointers even though Solver::Options took ownership of these
objects.
This lead to buggy user code and the inability to copy Solver::Options
objects around.
With this change, these naked pointers have been replaced by a
shared_ptr object which will managed the lifetime of these objects. This
also leads to simplification of the lifetime handling of these objects
inside the solver.
The Android.mk and Application.mk files have also been updated
to use a newer NDK revision which ships with LLVM's libc++.
Change-Id: I25161fb3ddf737be0b3e5dfd8e7a0039b22548cd
- Breaking change: Problem::Options::enable_fast_parameter_block_removal
is now Problem::Options::enable_fast_removal, as it now controls
the behaviour for both parameter and residual blocks.
- Previously we did not check that the specified residual block to
remove in RemoveResidualBlock actually represented a valid residual
for the problem.
- This meant that Ceres would die unexpectedly if the user passed an
uninitialised residual_block, or more likely attempted to remove a
residual block that had already been removed automatically after
the user removed a parameter block upon on which it was dependent.
- RemoveResidualBlock now verifies the validity of the given
residual_block to remove. Either by checking against a hash set of
all residuals maintained in ProblemImpl iff enable_fast_removal
is enabled. Or by a full scan of the residual blocks if not.
Change-Id: I9ab178e2f68a74135f0a8e20905b16405c77a62b
- Previously AutoDiffLocalParameterization would internally instantiate
a functor instance whenever one was required. This prohibits the
user passing arguments to the constructor of the functor.
- Now AutoDiffLocalParameterization can take over ownership of an
allocated functor which the user created. This mimics the behaviour
of AutoDiffCostFunction.
Change-Id: I264e1face44ca5d5e71cc20c77cc7654d3f74cc0
These two methods allow the user to associate upper and lower bounds
with individual parameters inside parameter blocks.
Change-Id: I68dc37f20b64408da510ba06b89a4f08df54ddad
CostFunction now uses int32 instead of int16
to store the size of its parameter blocks.
This is an API breaking change.
Change-Id: I032ea583bc7ea4b3009be25d23a3be143749c73e
1. Rename SolverTerminationType to TerminationType.
2. Consolidate the enum as
a. CONVERGENCE - subsumes FUNCTION_TOLERANCE, PARAMETER_TOLERANCE and GRADIENT_TOLERANCE
b. NO_CONVERGENCE
c. FAILURE - captures all kinds of failures including DID_NOT_RUN.
d. USER_SUCCESS
e. USER_FAILURE
3. Solver::Summary::error is renamed to be Solver::Summary::message, to both
reduce confusion as well as capture its true meaning.
Change-Id: I27a382e66e67f5a4750d0ee914d941f6b53c326d
There was a bug in the way RemoveFixedBlocksFromProgram was working.
It only removed the constant parameter blocks from the
linear_solver_ordering, it was not even aware of the
inner_iteration_ordering.
This change fixes this bug. The code for RemoveFixedBlocksFromProgram
is also cleaned up and made more readable and the test have been updated.
Thanks to Mikael Persson for reporting this.
Change-Id: I454fa89f9b6f4f6320b02d5235e6f322cc15ff51
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
Since we added special handling for the case for rho[2] < 0,
the bulk of CorrectJacobian is pointless in the common case.
So add a simple one dimensional loop which rescales the Jacobian.
This speeds up this method immensely.
The robustification of a Jacobian gets speeded up by > 50%.
Change-Id: I97c4e897ccbb5521c053e1fb931c5d0d32f542c7
This triggers -Wtype-limits warnings on comparisons
which are always true, since the test being done is
n >= 0, where n is of type size_t, which is always
true.
This causes problems when compiling Ceres on linux
with miniglog.
Change-Id: Ia1d1d1483e03469c71fde029b62ca6d84e9b27e0
The original visibility based preconditioning paper and
implementation only used the canonical views algorithm.
This algorithm for large dense graphs can be particularly
expensive. As its worst case complexity is cubic in size
of the graph.
Further, for many uses the SCHUR_JACOBI preconditioner
was both effective enough while being cheap. It however
suffers from a fatal flaw. If the camera parameter blocks
are split between two or more parameter blocks, e.g,
extrinsics and intrinsics. The preconditioner because
it is block diagonal will not capture the interactions
between them.
Using CLUSTER_JACOBI or CLUSTER_TRIDIAGONAL will fix
this problem but as mentioned above this can be quite
expensive depending on the problem.
This change extends the visibility based preconditioner
to allow for multiple clustering algorithms. And adds
a simple thresholded single linkage clustering algorithm
which allows you to construct versions of CLUSTER_JACOBI
and CLUSTER_TRIDIAGONAL preconditioners that are cheap
to construct and are more effective than SCHUR_JACOBI.
Currently the constants controlling the threshold above
which edges are considered in the single linkage algorithm
are not exposed. This would be done in a future change.
Change-Id: I7ddc36790943f24b19c7f08b10694ae9a822f5c9
This adds three new public methods to ceres::Problem:
Problem::GetResidualBlocks()
Problem::GetParameterBlocksForResidualBlock()
Problem::GetResidualBlocksForParameterBlock()
These permit access to the underlying graph structure of the problem.
Change-Id: I55a4c7f0e5f325f140cb4830e7a7070554594650
The Taylor series approximation had its sign flipped and the
tests did not catch it since we were switching exactly at zero,
which was not getting triggered.
This changes modifies the tolerance, adds a test that triggers
and fixes the bug.
Thanks to Michael Samples for reporting this.
Change-Id: I6f92f6348e5d4421ffe194fba92c04285449484c
1. Update the documentation to be Sphinx friendly.
2. Remove dead fields in Solver::Summary.
a. Solver::Summary::num_eliminate_blocks_given.
b. Solver::Summary::num_eliminate_blocks_used.
Change-Id: I43e0070c88abe3bf285d91e6c7524f3d887deb33
Move the GradientCheckingCostFunction to DynamicNumericDiffCostFunction.
Also fix a const correctness issue with DynamicNumericDiffCostFunction.
Change-Id: Id446810f43374e7b7db7fe4dd01a891e3c54abb9
- Earlier versions of Clang (up to at least v3.0) throw an ambiguous
operator= error in this assignment. Variations on this error have
cropped up occassionally in some other projects (e.g. PCL).
Change-Id: I73a632c43528eb69840ce697c55d9afc5f3d8e59
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
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. 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
1. Typo in c_api.h
2. The stream operator for FunctionSample is now in the ceres::internal namespace.
Change-Id: Id927a7a49c47d8903505535749ecca78cd2e83b3
This extends the C API to support loss functions. Both
user-supplied cost functions as well as the stock Ceres cost
functions (Cauchy, Huber, etc) are supported. In addition, this
adds a simple unit test for the C API.
Supporting loss functions required changing the signature of the
ceres_add_residual_block() function to also take a thunk for the
loss function.
Change-Id: Iefa58cf709adbb8f24588e5eb6aed9aef46b6d73
lm_max_diagonal -> max_lm_diagonal
lm_min_diagonal -> min_lm_diagonal
linear_solver_max_num_iterations -> max_linear_solver_iterations
linear_solver_min_num_iterations -> min_linear_solver_iterations
This follows the pattern for the other parameters in Solver::Options
where, the max/min is the first word followed by the name of the
parameter.
Change-Id: I0893610fceb6b7983fdb458a65522ba7079596a7