This PR changes the interface of sized_cost_fucntion,
autodiff_cost_function and numeric_diff_costfunction from using ten
hardcoded parameter blocks to a variable number of parameter blocks
using variadic templates.
Trailing parameter blocks of size zero are now considered as error.
Change-Id: I37b9a0a420ef0eda6476a46672bbf6bd57e19760
Introduce IsSetConstantByUser method which indicates whether
the user set the parameter block constant or not.
Changed the definition of IsConstant() to indicate if the
parameter block is effectively constant or not, which is
now the uniion of two conditions - the user set it to be constant
or the local tangent space is of size zero. Currently
this change has no effect as we do not allow local parameterizations
with zero tangent space size, but thats an inconsistency we are
working on fixing.
A variety of code cleans up to parameter_block.h
1. Remove an old TODO comment which is not really actionable.
2. Remove Init() method.
3. NULL -> nullptr
4. memcpy -> std::copy
Change-Id: I12973ee0f053fa22f09908cf36e9aa57d9d8dd74
The class parameter dims is a helper class that holds the parameter
dimensions. The parameter dimensions are either dynamic or the
sizes are known at compile time. It is used to pass parameter block
dimensions around (e.g. between functions or classes).
Also the dimensions of the parameter blocks are checked at compile
time and must be greater than zero. This means trailing zero parameter
blocks will result in a compile error.
Change-Id: I4decf2f09e63fdb0fd652022b2be2a1cfd9c4478
This patch removes the use of trailing zeros in cost functions used in
unit tests as this will be an error once the sized cost function is
implemented using variadic templates.
Change-Id: I3e8a31b310ba7299fc6b1f012f540a3118cc7661
This PR adds integer sequence and two algorithms (sum and exclusive
scan). Those will be needed to implement a sized cost function using
variadic templates.
Change-Id: I8e98d7c11fac94286fe9c364633406e59438f059
A variety of small cleanups to the local parameterization
implementation and tests to improve readability.
Change-Id: I5457206129cb3c301999d2f88912ba8300a2c934
All Init() function overloads are replaced by a perfect forwarding Init
function using variadic templates.
Change-Id: I42d0e236d274174982a4e56c0d73ec2776ed96f8
Enable use of dynamic number of residuals for autodiff.
Implemented with "Substitution failure is not an error" similar
to tiny_solver.h .
Move test from tiny_solver_test.cc to
tiny_solver_autodiff_function_test.cc .
Use cpplint.py from C++ Google Style Guide for formatting.
Change-Id: I2e1a159d17118552943c6ac7a833c5bbd0c927ec
There are overloaded operators supporting operations between a double and a Jet, so there
is no need to convert a double to a Jet.
Change-Id: I9cfcefb32c6b1a5ad716496b620d578871f0ff03
The example code for ceres::Jet is incorrect since it misses at which point
the derivate is computed.
Change-Id: Ic3f2ee061a2b69f0a402ca1a01297ddda1f153cd
When Jacobian is needed, a different function is called internally. Thus we have to recheck the residual.
Change-Id: I83044b3668479fc21b6612662271e872addf6f48
- Previously we were only bounding num_threads_used based on whether
CERES_NO_THREADS was defined, meaning that we could erroneously report
a value larger than the number of threads actually used.
Change-Id: I7373c0c968f9be268c8b7ab0b9561ae31700fda6
- Required now that Threads is a public dependency for Ceres and so
Threads::Threads will appear in the dependency list for the Ceres
target and so must be defined when Ceres itself is imported.
Change-Id: Ia5f8ea16e8f24cf0158f40e1fc8d3962106459a6
- Required to propagate the threading flags to example targets that
depend upon Ceres and do not directly specify threads as a dependency
to support some *nix builds.
Change-Id: I1c229bd0241da55a203c2b1f8fc28ea43c312e69
This header defined integral types in the pre-C++11 days, and can
be replaced with <cstdint> and the types defined therein.
Also remove a shallow (and incorrect) typedef in include/ceres/types.h
https://github.com/ceres-solver/ceres-solver/issues/409
Change-Id: I398c652f74d24bbeea459672508bf28f591b100f
When Solver::Options::check_gradients is true, Ceres internally
creates a new ProblemImpl object which wraps each CostFunction
in the user's problem with a GradientCheckingCostFunction.
Doing this also requires creating new ParameterBlock objects,
and when support for upper and lower bounds was added to Ceres,
CreateGradientCheckingProblemImpl should also have been updated
to create a problem with the same parameter bounds. As a result,
if check_gradients is enabled for a bounded problem, it constructs
an unconstrained problem and solves it.
This CL fixes this, by introducing Problem::GetParameterLowerBound,
and Problem::GetParameterUpperBound and using them to create a bounded
problem when checking gradients.
Thanks to @pbeeson for not only reporting this problem, but also
providing a small standalone reproduction which made debugging this
possible.
https://github.com/ceres-solver/ceres-solver/issues/379
Change-Id: Id18eb858a7009bf4fa452a21b925922d13f3249f
When using the SchurEliminator to compute a preconditioner, there
is no rhs. This CL removes that limitation and simplifies the
call sites in the two preconditioners.
https://github.com/ceres-solver/ceres-solver/issues/271
Change-Id: I05b8518fdc9f0d1a6d88ae76d3a7e8e838e7204a
All three errors are of the form where, the vector storing
the columns array for a CompressedRowSparseMatrix is being
accessed out of bounds. But in each case, the access is innocuous
because there are other tests which prevent it from being used.
However, if one compiles with debug mode on, the bounds checking
in the underlying std::vector triggers an error.
More details:
1. FromTripletSparseMatrix tried accessing the col vector of
a matrix with zero rows, but the following code was a no-op
because there was nothing to copy.
Adding an early return which deals with this case fixes this.
2. RightMultiply and SquaredColumnNorm had the following loop
while (r > cols_[idx] && idx < idx_end) {
++idx;
}
where cols_ was being accessed out of bounds, before idx < idx_end
was being checked. Swapping the order of the comparisons fixes this
error.
@richmattes reported this error.
https://github.com/ceres-solver/ceres-solver/issues/383
Change-Id: I2dbc90ef24ecaffc6f46f1622339d6053b43db45
This was currently being done in README.md, but thats likely not
the best way to do this, CONTRIBUTING.md is shown to users
if they try to create PR on github.
So this CL pulls out the bits that point folks to Gerrit and puts
them in CONTRIBUTING.md
Change-Id: I1d2be0d89cbff72c0655ba341756dd0f54e2ea7f
CMake support in Android is now standard and the CMake file
has fuller richer functionality than the Android.mk file ever did.
https://github.com/ceres-solver/ceres-solver/issues/364
Change-Id: Ib79bcc19dd47495a81a5d07fafdf06eb8005984e
- In light of the C++11 threads threading option this is no longer
necessary for cross-platform threading support and did not offer a
noticeable performance gain over either the C++11 threads
implementation or OpenMP.
Change-Id: Icb588d520888c19a1775171795b55bcaffb3d256
- Now that we require CMake >= 3.x, we can roll the definition of the
include directories for clients linking against Ceres into the
exported Ceres CMake target via target_include_directories().
- This removes the requirement for CERES_INCLUDE_DIRS.
Change-Id: Ibe3bbf796339871d66138fc9520053d1766f09a8