From 299fcf1e047dd7bba6c80641b79dc4c7024c151e Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Fri, 11 Dec 2009 04:57:31 +0000 Subject: [PATCH] scale is const ! --- cpp/VectorConfig.cpp | 5 ++--- cpp/VectorConfig.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cpp/VectorConfig.cpp b/cpp/VectorConfig.cpp index 8577b3561..a096d271b 100644 --- a/cpp/VectorConfig.cpp +++ b/cpp/VectorConfig.cpp @@ -27,12 +27,11 @@ void check_size(const string& key, const Vector & vj, const Vector & dj) { } /* ************************************************************************* */ -VectorConfig VectorConfig::scale(double gain) { +VectorConfig VectorConfig::scale(double gain) const { VectorConfig scaled; string key; Vector val; - FOREACH_PAIR(key, val, values) { + FOREACH_PAIR(key, val, values) scaled.insert(key, gain*val); - } return scaled; } diff --git a/cpp/VectorConfig.h b/cpp/VectorConfig.h index 32449a6be..25e327def 100644 --- a/cpp/VectorConfig.h +++ b/cpp/VectorConfig.h @@ -60,7 +60,7 @@ namespace gtsam { VectorConfig exmap(const VectorConfig & delta) const; /** Scales the configuration by a gain */ - VectorConfig scale(double gain); + VectorConfig scale(double gain) const; const_iterator begin() const {return values.begin();} const_iterator end() const {return values.end();}