Use same instance of a PRNG throughout by passing it to methods and
functions as an argument to generate random numbers without breaking the
sequence.
Change-Id: Ib024bbc1ea2d14e4b9afb71857856a5fb77b1667
The code that verifies that the linear solver is configuration
specified by the user has grown into a rat's nest. This CL
attempts to bring some order to this madness.
Fixes https://github.com/ceres-solver/ceres-solver/issues/852
Change-Id: I3f34c0e27da13a6412117dee43ef2d9ec3835b64
These changes came about from testing the power bundle adjustment
integration CL.
1. Allow Solver::Options::max_linear_solver_iterations == 0.
2. Simplify the logic for when inverse(F'F) is computed.
3. norm_b -> norm_rhs in ConjugateGradientsSolver.
Change-Id: I50c19e1f24a4cc08ed60e3a3032b96b37bcada9f
Implementation of "Power Bundle Adjustment for Large-Scale 3D
Reconstruction" by Weber et. al. added in the form of preconditioner.
Change-Id: Ie85526a5fc46f74256f6dfe9173c3571f7160f3a
These methods were historically poorly named and every time I read code
I get confused whether they are just multiplying or multiplying and
adding. Clarifying them also gives us the changce to introduce
RightMultiply and LeftMultiply methods in the base class which will
simplify a number call sites in a subsequent CL.
Fixes https://github.com/ceres-solver/ceres-solver/issues/855
Change-Id: Ice4fb483f1acd02527a6dd753ef0c5a66037f4b0
1. Convert it from a class to a template function. Where the
template parameter is "DenseVectorType". This allows us
to have a single implementation of Conjugate Gradients
without worrying about where the matrix and the vectors
are stored or what their internal representation is.
For the case of CPU based vectors, we abstract operations
on Eigen vectors using eigen_vector_ops.
2. Introduce ConjugateGradientsLinearOperator which is
templated on DenseVectorType. It is the matrix vector
multiplication abstraction.
3. Port the tests and all usages of ConjugateGradientsSolver
to this new implementation.
4. Introduce Eigen::Vector based RightMultiply and LeftMultiply
methods into LinearOperator which by default delete to the
bare pointer based interfaces.
5. Add an identity preconditioner.
These changes are being made in preparation for adding a CUDA
based CGNR solver.
Change-Id: I9da36dc6c131856dd1a4aa7e645aaf12d25dd79b
This PR changes the Sphere and Line Manifold formulations so that their
tangent spaces represent traveled angles (for the sphere and the line
direction vector) and traveled distance (for the line origin). These
magnitudes were previously halved according to "Hartley & Zisserman
(2nd Edition)", but in the majority of the state of the art this is not
done, following the convention that magnitudes in the tangent space of
the unit sphere represent geodesic distances traveled on that manifold.
The same scale factor appears in the Quaternion Manifold implementation
and will be studied in a further PR.
This PR also adds an additional case in the Sphere Minus operator when
hy_norm == 0. The value of y_minus_x was fixed to 0 but actually its
last term can also be Pi depending on y_last.
Finally, new unit tests for the Plus and Minus operator are added, along
with new tests for the 2D Sphere (a.k.a. Circle) Manifold.
Change-Id: I9456f1675b20da49bede5d6759aabf3cdfb26eae
1. Remove an unused variable from block_sparse_matrix.cc
2. Add explicit types to the distributions to get around
-Wctad-maybe-unsupported
Change-Id: Ib7d606fbfe2b93ba4fce408f38ee4f7626b74ff0
* Fixed an alignment bug with EventLogger.
* Added expected solutions to some LinearLeastSquaresProblem tests.
* Expanded ContextImpl to initialize cuSparse.
Change-Id: I2d7556a0509e9b7c56c9cd5cfa75cb85614395dc
InnerProductComputer was assuming that the input matrix had
at least one structurally non-zero block. As a result sometimes
when InnerProductComputer.SubMatrix test generated matrices
where the submatrix was structurally zero it would cause
a segmentation fault.
This changes fixes this issue and reduces the threshold for the
minimum block density so that there is a much higher chance of
such matrices occuring as part of testing.
Fixes https://github.com/ceres-solver/ceres-solver/issues/820
Change-Id: Iec3a2431e646f0c2aac9e0b994531fa72323f329
* Renamed several interfaces to CudaBuffer for clarity and consistency.
* Added unit tests for custom Cuda kernels.
* Set specific CUDA architectures if the CMake version supports it.
Change-Id: I269fb1089b80b25e17bca772ef8d70e7894214b8
sparse linear solvers.
* Add methods to convert TripletSparseMatrix and BlockSparseMatrix to
CRSMatrix structure.
* Added tests for conversion of TripletSparseMatrix and BlockSparseMatrix
to CRSMatrix structure.
* Added documentation on the BlockSparseMatrix structure.
Change-Id: I020cfa91c301567ceeb39ff2064183c5d88c9ed5
On problem-744-543562-pre.txt
The time spent in linear solver on my M1 Pro is
eigen 81.550970
eigen+mixed 54.107383
LAPACK 47.078127
LAPACK+mixed 28.639868
Solution quality is unaffected.
The implementation of RefinedDenseCholesky and DenseIterativeRefiner
are straightforward ports of RefinedSparseCholesky and
SparseIterativeRefiner (formerly IterativeRefiner).
It maybe possible to refactor the SparseCholesky and DenseCholesky
interfaces so that this code duplication can be removed in the
future.
Change-Id: I921334224cb97629a60390f2add822de207f7923
Since Eigen does not allow to have a RowMajor column vector (see
https://gitlab.com/libeigen/eigen/-/issues/416), the storage order
must be set to ColMajor in that case. This fix adds that special
case when generating 2D sphere manifolds.
Change-Id: I594932e0dafc878e0b348f72524478588e61b34d
CERES_METIS_VERSION needs to be set if either Eigen or
SuiteSparse are using it. Previously, we were conditioning it
only on EIGENMETIS being ON.
Change-Id: I380a3b138b79903aa142b560ed46f438ff549a82
Because we store the matrix as row major matrix, the
obvious Eigen expression performs rather poorly. A straight
c++ loop speeds things up considerably.
Also replace use of matrix() with direct use of m_.
Change-Id: I3d6166df4765ad8400ab9602a54b65fd21b1d50f
MSVC rightfully issues warning C4305: 'if': truncation from 'size_t' to
'bool' in a static_assert condition that implicitly converts sizeof
result to a boolean.
Change-Id: Ie3b913288bfeaa7a4b362ef7f83d2505ed368641
- These are non-standard C++, and whilst they are accepted by GCC and
Clang on *NIX and macOS, they are rejected by MSVC.
Change-Id: Ie627d74bb02ebdce3dc5e13c2010616c26cb5dea
- Also fixes behaviour of EIGENMETIS option to match that of the other
CMake dependency options, and ensure that its value aligns exactly
with whether Eigen support for METIS will be compiled into Ceres.
Change-Id: Ifbf6f5d82b9ba89a156673eb6042519a985e6b04
* Split `CERES_NO_METIS` into two defines: `CERES_NO_PARTITION` and
`CERES_NO_METIS`. The former refers to METIS support in SuiteSparse,
the latter to the Eigen's MetisSupport module. This enables the use of
sparse matrix reordering independent from SuiteSparse.
* Run Linux, macOS, and macOS Github workflows with METIS enabled
SuiteSparse.
Fixes#808
Change-Id: I5076b7e1268d32cc3e7e56650edcbaf7fb3b59ce
- Prior to 48cb54d1, Ceres' fmin/fmax() for Jets followed the convention
of std::min/max(), and always returned the first argument on equality,
irrespective of whether this argument was natively a scalar or a Jet.
- After 48cb54d1, Ceres' fmin/fmax() instead returned the second
argument on equality, again irrespective of whether this argument was
natively a scalar or a Jet.
- Now on equality we average the arguments as Jets, which ensures that
a consistent answer is produced irrespective of the ordering or type
(Jet or scalar) of the input arguments. This also ensures that we
preserve a non-zero derivative where it exists, excluding the edge
case of two Jet inputs with equal but oppositely signed infinitesimal
components.
- We retain the behaviour introduced in 48cb54d1 whereby NaNs are
treated as missing values, following the convention of
std::fmin/fmax().
- Raised as issue #816.
Change-Id: I01217c0e32c1be83be440e4515b57c79dd290923
* Unfortunately on some systems such as the Nvidia Jetson, while the
compiler supports C++17, the STL implementations are incomplete.
One such missing implementation is std::exclusive_scan, so this
patch reverts to the old way of manually computing prefix sums.
Change-Id: I4192257519b0083560a4b44e2659ee44d7421105
1. The platform specific threads library is only needed if we actually
use threads. In this case, the library is not optional opposed to
previous logic.
2. Do not hide the find module output to allow the user to understand
what happens in case of a CMake failure to locate Threads.
3. Finally, Threads is private dependency that does need to be
propagated to consumers unless Ceres was compiled as a static
library.
Change-Id: I8d9d9cd42930e1ed234f69a2dba70d0ee2755b4e
Depending on the compiler in use, linking against OpenMP may require
passing specific compiler flags instead of linking against a library.
Use the CMake OpenMP find module to abstract OpenMP activation.
Change-Id: Ib43f576ac12e2c5e9598e9586df3dfa018e9c08b