Unify Block handling across matrix types

Previously some matrices used Block to keep track of
row/column block sizes and some would just use ints, and
then compute the position of each row and column from it.

By uniformly using Block everywhere, we reduce duplicate
computation and data copies.

I also cleaned up a bunch of c++17 related stuff as I edited
these files.

Change-Id: I4c86b1593fd4c91f9057fbb38314f62f303e0477
This commit is contained in:
Sameer Agarwal
2022-08-29 21:52:30 -07:00
parent 5f19468794
commit f86a3bdbea
32 changed files with 451 additions and 569 deletions
@@ -37,6 +37,7 @@
#include <vector>
#include "ceres/block_random_access_matrix.h"
#include "ceres/block_structure.h"
#include "ceres/internal/disable_warnings.h"
#include "ceres/internal/export.h"
#include "ceres/triplet_sparse_matrix.h"
@@ -50,7 +51,7 @@ class CERES_NO_EXPORT BlockRandomAccessDiagonalMatrix
: public BlockRandomAccessMatrix {
public:
// blocks is an array of block sizes.
explicit BlockRandomAccessDiagonalMatrix(const std::vector<int>& blocks);
explicit BlockRandomAccessDiagonalMatrix(std::vector<Block> blocks);
BlockRandomAccessDiagonalMatrix(const BlockRandomAccessDiagonalMatrix&) =
delete;
void operator=(const BlockRandomAccessDiagonalMatrix&) = delete;
@@ -86,7 +87,7 @@ class CERES_NO_EXPORT BlockRandomAccessDiagonalMatrix
private:
// row/column block sizes.
const std::vector<int> blocks_;
const std::vector<Block> blocks_;
std::vector<CellInfo*> layout_;
// The underlying matrix object which actually stores the cells.