more precise use of setZero() and add comments

release/4.3a0
Jose Luis Blanco-Claraco 2020-05-18 08:30:00 +02:00
parent a76c0a20ee
commit 9fc0901655
No known key found for this signature in database
GPG Key ID: D443304FBD70A641
1 changed files with 3 additions and 1 deletions

View File

@ -71,6 +71,7 @@ namespace gtsam {
}
/// Construct from a container of the sizes of each block.
/// Uninitialized blocks are filled with zeros.
template<typename CONTAINER>
SymmetricBlockMatrix(const CONTAINER& dimensions, bool appendOneDimension = false) :
blockStart_(0)
@ -81,6 +82,7 @@ namespace gtsam {
}
/// Construct from iterator over the sizes of each vertical block.
/// Uninitialized blocks are filled with zeros.
template<typename ITERATOR>
SymmetricBlockMatrix(ITERATOR firstBlockDim, ITERATOR lastBlockDim, bool appendOneDimension = false) :
blockStart_(0)
@ -95,7 +97,7 @@ namespace gtsam {
SymmetricBlockMatrix(const CONTAINER& dimensions, const Matrix& matrix, bool appendOneDimension = false) :
blockStart_(0)
{
matrix_.setZero(matrix.rows(), matrix.cols());
matrix_.resize(matrix.rows(), matrix.cols());
matrix_.triangularView<Eigen::Upper>() = matrix.triangularView<Eigen::Upper>();
fillOffsets(dimensions.begin(), dimensions.end(), appendOneDimension);
if(matrix_.rows() != matrix_.cols())