mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
5f433c8a22d205996f0c0b327ba3aa626928fb45
CreateJacobianBlockSparsityTranspose starts with a conservative estimate of the size of the block sparsity pattern of the Jacobian. When the Jacobian has more non-zeros than that, the TripletSparseMatrix being used to store the sparsity has a Reallocate method which allows one to resize the matrix and IF num_nonzeros is set, then the existing values in the array are also copied into the newly allocated memory. Unfortunately the pattern we follow in ceres code is to call set_num_nonzeros after one is done populating the sparsity pattern of a matrix. This does not mix well with Reallocate and results in the matrix having uninitialized memory. This patch fixes this problem and adds a test that verifies the fix. Thanks to Yuliy Schwartzburg for reporting this bug and providing code to reproduce it. Change-Id: I58583714ffaebd880d85af16e3685b2d6ee053e8
Ceres Solver - A non-linear least squares minimizer ================================================== Please see docs/html/index.html for a tutorial and reference.
Description
Languages
C++
94.4%
CMake
3.8%
Python
0.8%
C
0.5%
Starlark
0.4%