From 355141f9857301224d0c9c78b6aa737ce4160179 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 15 Aug 2012 17:17:52 +0000 Subject: [PATCH] Added dense matrix accessor for JointMarginals --- gtsam.h | 1 + gtsam/nonlinear/Marginals.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/gtsam.h b/gtsam.h index fd36a28c0..262e1d105 100644 --- a/gtsam.h +++ b/gtsam.h @@ -1239,6 +1239,7 @@ class Marginals { class JointMarginal { Matrix at(size_t iVariable, size_t jVariable) const; + Matrix fullMatrix() const; void print(string s) const; void print() const; }; diff --git a/gtsam/nonlinear/Marginals.h b/gtsam/nonlinear/Marginals.h index 588531830..302c686e8 100644 --- a/gtsam/nonlinear/Marginals.h +++ b/gtsam/nonlinear/Marginals.h @@ -116,6 +116,13 @@ public: Block at(Key iVariable, Key jVariable) const { return (*this)(iVariable, jVariable); } + /** The full, dense covariance/information matrix of the joint marginal. This returns + * a reference to the JointMarginal object, so the JointMarginal object must be kept + * in scope while this view is needed. Otherwise assign this block object to a Matrix + * to store it. + */ + const Matrix& fullMatrix() const { return fullMatrix_; } + /** Copy constructor */ JointMarginal(const JointMarginal& other);