diff --git a/gtsam.h b/gtsam.h index 76804a769..3868ed4bf 100644 --- a/gtsam.h +++ b/gtsam.h @@ -1095,6 +1095,9 @@ class VectorValues { void resize(size_t nVars, size_t varDim); void setZero(); + gtsam::VectorValues add(const gtsam::VectorValues& c) const; + gtsam::VectorValues scale(double a, const gtsam::VectorValues& c) const; + //FIXME: Parse errors with vector() //const Vector& vector() const; //Vector& vector(); diff --git a/gtsam/linear/VectorValues.h b/gtsam/linear/VectorValues.h index 1e63c5bb5..880bdcd5f 100644 --- a/gtsam/linear/VectorValues.h +++ b/gtsam/linear/VectorValues.h @@ -303,6 +303,15 @@ namespace gtsam { /// @} + /// @} + /// @name Matlab syntactic sugar for linear algebra operations + /// @{ + + inline VectorValues add(const VectorValues& c) const { return *this + c; } + inline VectorValues scale(const double a, const VectorValues& c) const { return a * (*this); } + + /// @} + private: // Throw an exception if j does not exist void checkExists(Index j) const {