Added a constructor to create an n-ary factor from an std::vector of key/A-matrix pairs

release/4.3a0
Richard Roberts 2009-10-22 14:27:03 +00:00
parent c3b8a20b5c
commit ae57441c3d
1 changed files with 10 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include <set>
#include <ostream>
#include <boost/shared_ptr.hpp>
#include <vector>
#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<std::pair<std::string, Matrix> > &terms,
const Vector &b_in) :
b(b_in) {
for(unsigned int i=0; i<terms.size(); i++)
As.insert(terms[i]);
}
/** Construct from Conditional Gaussian */
CONSTRUCTOR
LinearFactor(const std::string& key, const boost::shared_ptr<