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();}