From 81b9fc33b7c01ba66897d4d2324faf2d1bbe7701 Mon Sep 17 00:00:00 2001 From: Duy-Nguyen Ta Date: Tue, 6 Aug 2013 15:35:37 +0000 Subject: [PATCH] in diag with matrices: initialize the result with zeros first. --- gtsam/base/Matrix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam/base/Matrix.cpp b/gtsam/base/Matrix.cpp index ad0c7c9f4..c4ad41879 100644 --- a/gtsam/base/Matrix.cpp +++ b/gtsam/base/Matrix.cpp @@ -292,7 +292,7 @@ Matrix diag(const std::vector& Hs) { rows+= Hs[i].rows(); cols+= Hs[i].cols(); } - Matrix results(rows,cols); + Matrix results = zeros(rows,cols); size_t r = 0, c = 0; for (size_t i = 0; i