From 9fc090165524f094ba93393440ecbc9dbdc8c483 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Mon, 18 May 2020 08:30:00 +0200 Subject: [PATCH] more precise use of setZero() and add comments --- gtsam/base/SymmetricBlockMatrix.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtsam/base/SymmetricBlockMatrix.h b/gtsam/base/SymmetricBlockMatrix.h index 1ec9a5ad3..c2996109f 100644 --- a/gtsam/base/SymmetricBlockMatrix.h +++ b/gtsam/base/SymmetricBlockMatrix.h @@ -71,6 +71,7 @@ namespace gtsam { } /// Construct from a container of the sizes of each block. + /// Uninitialized blocks are filled with zeros. template 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 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() = matrix.triangularView(); fillOffsets(dimensions.begin(), dimensions.end(), appendOneDimension); if(matrix_.rows() != matrix_.cols())