From ae57441c3d6d5ef743021d266d98e21ebf7230f9 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Thu, 22 Oct 2009 14:27:03 +0000 Subject: [PATCH] Added a constructor to create an n-ary factor from an std::vector of key/A-matrix pairs --- cpp/LinearFactor.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cpp/LinearFactor.h b/cpp/LinearFactor.h index ff4f7a55e..cd1ecbc49 100644 --- a/cpp/LinearFactor.h +++ b/cpp/LinearFactor.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "Matrix.h" #include "Factor.h" @@ -82,6 +83,15 @@ public: As.insert(make_pair(key3, A3)); } + /** Construct an n-ary factor */ + CONSTRUCTOR + LinearFactor(const std::vector > &terms, + const Vector &b_in) : + b(b_in) { + for(unsigned int i=0; i