1. Convert a CompressedRowSparseMatrix constructor which
takes a TripletSparseMatrix as input into a factory method
which allows the input to be transposed.
2. Move the random matrix creation routine for CompressedRowSparseMatrix
from being a standalone function to a static method.
3. Add a corresponding random matrix generation static method to
TripletSparseMatrix.
4. Add a new constructor to TripletSparseMatrix, which takes as input
the row, col and values arrays.
Change-Id: Iec7b184646818f432a5e6822bea3b2f3128a82aa
- Use target_compile_features() to specify the C++11 dependency for
Ceres if the CXX11 option is enabled and the current CMake version
supports it (>= 3.1). Otherwise fall back onto our existing
target_compile_options() solution if available.
- We prefer the use of target_compile_features() if available as it more
gracefully handles ‘upgrading’ of the C++ standard in client projects
that depend upon Ceres, e.g. if the client requires C++14. The
current solution may fail to produce the expected result in this case
as raised in
https://github.com/ceres-solver/ceres-solver/issues/273.
Change-Id: Ib3cff8d4b9fe93fa6d6b376b4dd53923bb1c4ecc
Now that there is a single piece of code doing the outer product
computation for all three sparse linear algebra backends, move
this code one level up the call stack and there by make the actual
per-library solver code shorter and simpler.
Also fix a minor omission in the outer product computation code
where row/column blocks were not being copied over to the
outer product matrix.
Change-Id: I22a7967bdc659385b741901afefa7af312e676e5
SchurEliminator::Init now takes a bool that tells it whether
it can assume that the diagonal blocks it is inverting can
be assumed to be full rank or not.
This information is then passed onto InvertPSDMatrix.
Change-Id: I26037b6233f2aad5584fed245f631c3959928afe
THIS IS AN API BREAKING CHANGE.
Decouple the algorithm from the sparse linear algebra
library being used to perform the computation.
Before this change
Covariance::AlgorithmType had values
DENSE_SVD
EIGEN_SPARSE_QR
SUITE_SPARSE_QR
This has been replaced by two enums now.
Covariance::Options::sparse_linear_algebra_library_type
which can take values EIGEN_SPARSE, SUITE_SPARSE or CX_SPARSE.
The last one is currently not supported.
And Covariance::Options::algorithm_type takes values
DENSE_SVD
SPARSE_QR
This sets the stage for future extensions of the covariance
computation algorithm.
Also as part of this change, the covariance computation chapter
has been made a top level chapter on its own instead of being
buried deep inside the Solving Non-linear Least Squares problem.
Change-Id: Ibfbf60902d8d17694d9ff585047a5a57d329ab22
SolveLowerTriangularInPlace
SolveLowerTriangularTransposeInPlace
were unused functions which can be removed.
Change-Id: I0fd29c1efae2a0a74666f6e3541473bebc22ae82
This code was currently buried under a bool inside SparseNormalCholeskySolver.
Pulling this out in its own solver makes the code simpler more readable
and more performant in the case of SuiteSparse.
Change-Id: I72379ca9ca162abbb83c12f7ee8ff92bc71e772c
By adding an enum to CompressedRowSparseMatrix, which indicates
whether the matrix is unsymmetric, upper or lower triangular
we are able to improve the readability and fix some minor
bugs in the way some matrix manipulation code was being
called.
Thank to William Rucklidge for this suggestion.
Change-Id: I355c90d11cd5d31f5a25741b0bda4fc4583e9095
Move it to compressed_row_sparse_matrix.h/cc for upcoming re-use.
Also clean up the tests for ComputeOuterProduct so that they do
not depend on CXSparse anymore and use Eigen instead. This also
makes the test simpler and shorter.
Change-Id: I06bbeb3b0c6a07fb1f3da354ef0abd17d246be9a
1. Add stype to the outerproduct computation to control the output
matrix in upper or lower triangular matrix. For SuiteSparse,
upper triangular matrix is generated. SuiteSparse can directly use
this matrix format for cholesky without matrix transpose overhead.
2. Change the outerproduct computation to block multiplication. This
reduces the computation complexity for the sort in preprocessing, also
allows formulation of the block outerproduct computation as dense Eigen
block matrix multiplication.
3. Solve 32 Tango problems on Qualcomm MSM8994 Cortex-A53 (1.55GHz)
before change: 140 seconds
after change: 131 seconds
Change-Id: I8054114cef911de6a303310a448821ca296e4744
- Using Ceres_[SOURCE/BINARY]_DIR (which are defined by CMake when
project(Ceres) is called, in favour of CMAKE_[SOURCE/BINARY]_DIR
enables Ceres to be nested within (and built by) a larger CMake
project (which also contains other projects).
- CMAKE_[SOURCE/BINARY]_DIR always refers to the top-level source
and binary directories (i.e. the first encountered), as a result if
Ceres is a nested project within a larger project, these would not
correctly identify the source/binary directories for Ceres (as they
would refer to the root project in which Ceres is nested).
- Using Ceres_[SOURCE/BINARY]_DIR should ensure that Ceres always uses
the correct source/binary directories, irrespective of whether Ceres
is nested or not.
Change-Id: I62226ea3f6552b1d7e2bdac1aef02f1f489ae55e
Ensures that a quadratic function can be minimizer to zero
and the final cost is reported correctly.
Change-Id: Ib03752b627988dc8038566ed1fa444b7d9d2fd2d
Previously, even when an iteration was successful, the LineSearchMinimizer
would only add the iteration summary to the Summary object if none
of the convergence tests were passed. This could cause iterations with
significant progress in the last iteration to be mis-reported.
The solution would be correct, but the actual cost would be misreported.
This change changes the order of these operations and ensures that
the iteration summary is added whenever the iteration itself is successful.
Thanks to Daniel Weindl for reporting this.
Change-Id: Iff10eccb49d50ad28127f44e149c17fa466db4ae
- When compiling on Clang on OS X with MINIGLOG enabled, name lookup
finds two ambiguous definitions of WARNING, one in the global
namespace and one in the google namespace, both defined in the
miniglog version of logging.h.
Change-Id: I6f1ad7d2750e1ed20ec1ba4574aab599086431df
1. Add schur_templates.cc to Android.mk
2. When detecting the Schur structure of the Jacobian,
the check for whether linear solver being used is indeed
of Schur type or not, should use the LinearSolver::Options
struct created and populated by the preprocessor rather than
depending on the value in the input Solver::Options. The reason
is that the preprocessor may change the linear solver type
depending on the lack of a Schur structure in the problem.
Change-Id: I6f018f6817c05d704409181c7b1e25155528ab84
1. Refactor the python code that generates the template specializations
to remove code duplication.
2. Improved the logic for template specialization selection where
Eigen::Dynamic now serves as a wildcard.
3. Added schur_templates.h/cc which allows querying the set of available
template specializations without instantiating a linear solver.
4. Added Solver::Summary::schur_structre_given and
Solver::Summary::schur_structure_used and expose them in
Solver::Summary::FullReport for better performance debugging.
5. Updated the templates with newer dates and some minor comments cleanup
which lead to the the template specializations to be re-generated.
Change-Id: Iaf3c6f714353597899916c300465da01f151c3de
- ScalarBinaryOpTraits was introduced in Eigen 3.3, and thus breaks
compilation of Ceres for Eigen versions < 3.3.
- Reported as issue #252 by AustinDeric:
https://github.com/ceres-solver/ceres-solver/issues/252
Change-Id: Ie9b7dace17709c348b18b297f2d5306b054ce4b0
Changes in Eigen's implementation for FullPivLU significantly
degraded the performance of the line search as reported by Weiguang.
We do not completely understand what is going on, as Eigen's changes
seem sane. So for now, this change explicitly works around the
changes made by Eigen to restore the performance of the line search.
Figuring out the underlying problem and fixing it remains an open
issue.
https://github.com/ceres-solver/ceres-solver/issues/248
Change-Id: I9993d73a09dc990ab567ce6bc447f16eac74abec
This commit extends the use of Jets with Eigen matrices and arrays
by enabling the use of binary operators (such as scalar addition,
multiplication, as well as matrix multiplication) when one Eigen
matrix/array is of type Jet and the other is a scalar type. This
should increase performance since Jet types have optimized
scalar-to-jet binary operations.
Change-Id: Ia756064845d845cefcf0abb16d366331d2824b52
Binary operations between Jets and doubles are well defined
and should not require an explicit conversion to Jets to work.
This was an oversight earlier and lead to overzealous conversions
all over our in our example code.
Change-Id: I1799770818e136edfc0a5802d86037ce9aec4923
ResidualBlock evaluation has logic to ensure that CostFunction
should always fill out the residual and jacobian arrays completely
by using a special value to pre-populate these arrays.
This works for CostFunctions with analytical Jacobians but not for
AutoDiffCostFunction and NumericDiffCostFunction Jacobians.
There is no way to fix this for NumericDiffCostFunctions without
introducing significant performance penalties but the residual
evaluation fails, which should be enough to catch such errors.
For AutoDiffCostFunction the way the Jets are default initialized
was sidestepping this check. So now, the Jet that is used to
capture the output residuals is now initialized with
kImpossibleValue, which will ensure that if the user forgets
to fill all output fields, it triggers an evaluation error.
This change required that ceres::internal::kImpossibleValue be moved
out of array_utils.h/cc to types.h.
Change-Id: I35bb0946cf0785a5d43c7b5459a2272848fb2a9b
MSVC requires using google::GLOG_WARNING, but this breaks the build
inside google. So add a MSVC specific ifdef to guard against it.
Change-Id: I3509bb3fd2c01722a1c76545b57d2bf0224f6d6e
- Previously we were not listing gflags as a public dependency of Ceres
if it and glog were found (and MINIGLOG was not being used). This
does not reflect that if glog was compiled with gflags then it will
#include gflags/gflags.h in glog/logging.h, thus making gflags a
public dependency of anything linking against glog.
- On *nix OSs if glog/gflags are shared libraries this did not result
in a link error when compiling Ceres as the gflags symbols were
indirectly resolved. However, on MSVC this is not the case, and this
could result in unresolved gflags symbol link errors when compiling
Ceres.
- Now we add gflags to the list of public Ceres dependencies if both
glog and gflags are found (and MINIGLOG is not enabled).
Change-Id: I5ce6038fa816781cc81b378522068dc563d29c51
- GLOG_NO_ABBREVIATED_SEVERITIES is the default on Windows, in which
case google::WARNING is not defined.
- Remove Ceres-specific redefinition of WARNING in mock-log.h fork
in place of using non-abbreviated severity in the one place in
levenberg_marquardt_strategy_test where ScopedMockLog is actually
used.
- Remove unnecessary dependency of gradient_checking_cost_function_test
on ScopedMockLog.
Change-Id: I9fb540f638037b6015fd264cfc618c9d60f5686c
Support for parameter tolerance was added to the line search
minimizer was added a while ago, and calling Solve on a
non-linear least squares problem supported it but for some reason
the GradientProblemSolver::Options struct was missing this
option even though the documentation suggested that it was present!
Thanks to Noah Snavely for reporting this bug.
Change-Id: I57cf4ab396bc822c19fa298529e113b89664a349
This commit relaxes the tolerance value for comparing between the actual
local matrix and the expected local matrix. Without this fix,
EigenQuaternionParameterization.ZeroTest could fail as the difference
exactly matches the value of std::numeric_limits<double>::epsilon().
Change-Id: Ic4d3f26c0acdf5f16fead80dfdc53df9e7dabbf9
Previously, the test for the projective camera model would fail as no
tolerance is set in line 144. To resolve this, this commit changes
assert_equal to assert_near.
Change-Id: I6cd3379083b1a10c7cd0a9cc83fd6962bb993cc9
Any result of an arithmetic operation on floating-point matrices
should never be checked for strict equality with some expected
value, due to limited floating point precision on different machines.
This fixes some occurences of exact checks in the gradient checker
unit test that were causing problems on some platforms.
Change-Id: I48e804c9c705dc485ce74ddfe51037d4957c8fcb
Intel C compiler strictly asks for parallel loops with collapse to be
perfectly nested. Otherwise, compiling Ceres with ICC will throw an
error at line 348 of covariance_impl.cc.
Change-Id: I1ecb68e89b7faf79e4153dfe6675c390d1780db4
1. SubsetParameterization can now be constructed such that all
parameters are constant. This is required for it be used as part
of a ProductParameterization to hold a part of parameter block
constant. For example, a parameter block consisting of a rotation
as a quaternion and a translation vector can now have a local
parameterization where the translation part is constant and the
quaternion part has a QuaternionParameterization associated with it.
2. The check for the tangent space of a parameterization being
positive dimensional. We were not doing this check up till now
and the user could accidentally create parameterizations like this
and create a problem for themselves. This will ensure that even
though one can construct a SubsetParameterization where all
parameters are constant, you cannot actually use it as a local
parameterization for an entire parameter block. Which is how
it was before, but the check was inside the SubsetParameterization
constructor.
3. Added more tests and refactored existing tests to be more
granular.
Change-Id: Ic0184a1f30e3bd8a416b02341781a9d98e855ff7