Changed setBCN to take a reference
parent
5780b39816
commit
fd11a1e2c7
|
@ -57,8 +57,8 @@ public:
|
|||
|
||||
/** return begin and end of the nodes. FD: breaks encapsulation? */
|
||||
typedef std::map<std::string, ConditionalGaussian::shared_ptr>::const_iterator const_iterator;
|
||||
const_iterator const begin() {return nodes.begin();}
|
||||
const_iterator const end() {return nodes.end();}
|
||||
const_iterator const begin() const {return nodes.begin();}
|
||||
const_iterator const end() const {return nodes.end();}
|
||||
|
||||
/** optimize */
|
||||
boost::shared_ptr<FGConfig> optimize();
|
||||
|
|
|
@ -18,17 +18,17 @@ using namespace std;
|
|||
using namespace gtsam;
|
||||
|
||||
/* ************************************************************************* */
|
||||
LinearFactorGraph::LinearFactorGraph(ChordalBayesNet::shared_ptr CBN)
|
||||
LinearFactorGraph::LinearFactorGraph(const ChordalBayesNet& CBN)
|
||||
{
|
||||
setCBN(CBN);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void LinearFactorGraph::setCBN(ChordalBayesNet::shared_ptr CBN)
|
||||
void LinearFactorGraph::setCBN(const ChordalBayesNet& CBN)
|
||||
{
|
||||
clear();
|
||||
ChordalBayesNet::const_iterator it = CBN->begin();
|
||||
for(; it != CBN->end(); it++) {
|
||||
ChordalBayesNet::const_iterator it = CBN.begin();
|
||||
for(; it != CBN.end(); it++) {
|
||||
LinearFactor::shared_ptr lf(new LinearFactor(it->first, it->second));
|
||||
push_back(lf);
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ namespace gtsam {
|
|||
/**
|
||||
* Constructor that receives a Chordal Bayes Net and returns a LinearFactorGraph
|
||||
*/
|
||||
LinearFactorGraph(ChordalBayesNet::shared_ptr CBN);
|
||||
LinearFactorGraph(const ChordalBayesNet& CBN);
|
||||
|
||||
/**
|
||||
* given a chordal bayes net, sets the linear factor graph identical to that CBN
|
||||
* FD: imperative !!
|
||||
*/
|
||||
void setCBN(ChordalBayesNet::shared_ptr CBN);
|
||||
void setCBN(const ChordalBayesNet& CBN);
|
||||
|
||||
/**
|
||||
* This function returns the best ordering for this linear factor
|
||||
|
|
|
@ -457,7 +457,7 @@ TEST( LinearFactorGraph, CONSTRUCTOR_ChordalBayesNet )
|
|||
ord.push_back("x1");
|
||||
|
||||
ChordalBayesNet::shared_ptr CBN = fg.eliminate(ord);
|
||||
LinearFactorGraph fg2(CBN);
|
||||
LinearFactorGraph fg2(*CBN);
|
||||
ChordalBayesNet::shared_ptr CBN2 = fg2.eliminate(ord);
|
||||
|
||||
CHECK(CBN->equals(*CBN2));
|
||||
|
|
Loading…
Reference in New Issue