From edc4ffa6833e8d9b1f4bddfc4009a2bdee5ed752 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 23 May 2012 18:51:39 +0000 Subject: [PATCH] Fixed missing copy constructor and assignment operators in Marginals --- gtsam/nonlinear/Marginals.cpp | 13 +++++++++++++ gtsam/nonlinear/Marginals.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/gtsam/nonlinear/Marginals.cpp b/gtsam/nonlinear/Marginals.cpp index 34d620bc2..6df7dfdac 100644 --- a/gtsam/nonlinear/Marginals.cpp +++ b/gtsam/nonlinear/Marginals.cpp @@ -73,6 +73,19 @@ Matrix Marginals::marginalInformation(Key variable) const { } } +/* ************************************************************************* */ +JointMarginal::JointMarginal(const JointMarginal& other) : + blockView_(fullMatrix_) { + *this = other; +} + +/* ************************************************************************* */ +JointMarginal& JointMarginal::operator=(const JointMarginal& rhs) { + indices_ = rhs.indices_; + blockView_.assignNoalias(rhs.blockView_); + return *this; +} + /* ************************************************************************* */ JointMarginal Marginals::jointMarginalCovariance(const std::vector& variables) const { JointMarginal info = jointMarginalInformation(variables); diff --git a/gtsam/nonlinear/Marginals.h b/gtsam/nonlinear/Marginals.h index 77bccdfd2..fe5d4b21d 100644 --- a/gtsam/nonlinear/Marginals.h +++ b/gtsam/nonlinear/Marginals.h @@ -102,6 +102,12 @@ public: Block operator()(Key iVariable, Key jVariable) const { return blockView_(indices_[iVariable], indices_[jVariable]); } + /** Copy constructor */ + JointMarginal(const JointMarginal& other); + + /** Assignment operator */ + JointMarginal& operator=(const JointMarginal& rhs); + protected: Matrix fullMatrix_; BlockView blockView_;