From d8703b1c93c476fe344da8f2dd48a4b84bddf63b Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Fri, 22 Jun 2012 15:25:02 +0000 Subject: [PATCH] Reverting - Moved dim() from NonlinearFactor to NoiseModelFactor - for NonlinearFactors that linearize to HessianFactors, dimension is not defined. (reverse-merged from commit e9b6a7949524d4d8d4069abaee16d213792a3507) --- gtsam/nonlinear/NonlinearFactor.h | 3 +++ gtsam/slam/AntiFactor.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gtsam/nonlinear/NonlinearFactor.h b/gtsam/nonlinear/NonlinearFactor.h index f6869140c..e1cfb2bc3 100644 --- a/gtsam/nonlinear/NonlinearFactor.h +++ b/gtsam/nonlinear/NonlinearFactor.h @@ -124,6 +124,9 @@ public: */ virtual double error(const Values& c) const = 0; + /** get the dimension of the factor (number of rows on linearization) */ + virtual size_t dim() const = 0; + /** * Checks whether a factor should be used based on a set of values. * This is primarily used to implment inequality constraints that diff --git a/gtsam/slam/AntiFactor.h b/gtsam/slam/AntiFactor.h index 890e5beee..1e0d64db7 100644 --- a/gtsam/slam/AntiFactor.h +++ b/gtsam/slam/AntiFactor.h @@ -78,6 +78,9 @@ namespace gtsam { */ double error(const Values& c) const { return -factor_->error(c); } + /** get the dimension of the factor (same as the original factor) */ + size_t dim() const { return factor_->dim(); } + /** * Checks whether this factor should be used based on a set of values. * The AntiFactor will have the same 'active' profile as the original factor.