Added scale() and add() for VectorValues with a matlab interface

release/4.3a0
Alex Cunningham 2013-02-23 20:31:42 +00:00
parent 6e026959ac
commit 22f028ab51
2 changed files with 12 additions and 0 deletions

View File

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

View File

@ -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 {