From 90a0fa6e455b79476c5caf350339df6b081203f1 Mon Sep 17 00:00:00 2001 From: dellaert Date: Sun, 2 Nov 2014 13:53:22 +0100 Subject: [PATCH] Check if active --- gtsam_unstable/nonlinear/ExpressionFactor.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtsam_unstable/nonlinear/ExpressionFactor.h b/gtsam_unstable/nonlinear/ExpressionFactor.h index 68abedd02..69056e6ef 100644 --- a/gtsam_unstable/nonlinear/ExpressionFactor.h +++ b/gtsam_unstable/nonlinear/ExpressionFactor.h @@ -107,6 +107,10 @@ public: virtual boost::shared_ptr linearize(const Values& x) const { + // Only linearize if the factor is active + if (!this->active(x)) + return boost::shared_ptr(); + // Create a writeable JacobianFactor in advance // In case noise model is constrained, we need to provide a noise model bool constrained = noiseModel_->is_constrained();