From 8d28763339095fc84b6f79834266dbfd4b983b59 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 12 Jan 2010 16:12:31 +0000 Subject: [PATCH] Vector and Matrix initialization optimization --- cpp/Matrix.cpp | 7 +++---- cpp/Vector.cpp | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cpp/Matrix.cpp b/cpp/Matrix.cpp index 65bed6976..edbec380a 100644 --- a/cpp/Matrix.cpp +++ b/cpp/Matrix.cpp @@ -60,8 +60,7 @@ Matrix Matrix_(size_t m, size_t n, ...) { /* ************************************************************************* */ Matrix zeros( size_t m, size_t n ) { - Matrix A(m,n); - fill(A.data().begin(),A.data().end(),0.0); + Matrix A(m,n, 0.0); return A; } @@ -313,7 +312,7 @@ weighted_eliminate(Matrix& A, Vector& b, const Vector& sigmas) { // Then update A and b by substituting x with d-rS, zero-ing out x's column. for (int j=0; j