Renamed variable
parent
692ddd8f36
commit
15d5542809
|
|
@ -99,7 +99,7 @@ namespace gtsam
|
||||||
|
|
||||||
// Do dense elimination step
|
// Do dense elimination step
|
||||||
std::pair<boost::shared_ptr<ConditionalType>, boost::shared_ptr<FactorType> > eliminationResult =
|
std::pair<boost::shared_ptr<ConditionalType>, boost::shared_ptr<FactorType> > eliminationResult =
|
||||||
eliminationFunction(gatheredFactors, Ordering(node->keys));
|
eliminationFunction(gatheredFactors, Ordering(node->orderedFrontalKeys));
|
||||||
|
|
||||||
// Store conditional in BayesTree clique, and in the case of ISAM2Clique also store the remaining factor
|
// Store conditional in BayesTree clique, and in the case of ISAM2Clique also store the remaining factor
|
||||||
myData.bayesTreeNode->setEliminationResult(eliminationResult);
|
myData.bayesTreeNode->setEliminationResult(eliminationResult);
|
||||||
|
|
@ -123,7 +123,7 @@ namespace gtsam
|
||||||
const std::string& s, const KeyFormatter& keyFormatter) const
|
const std::string& s, const KeyFormatter& keyFormatter) const
|
||||||
{
|
{
|
||||||
std::cout << s;
|
std::cout << s;
|
||||||
BOOST_FOREACH(Key j, keys)
|
BOOST_FOREACH(Key j, orderedFrontalKeys)
|
||||||
std::cout << j << " ";
|
std::cout << j << " ";
|
||||||
std::cout << "problemSize = " << problemSize_ << std::endl;
|
std::cout << "problemSize = " << problemSize_ << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ namespace gtsam
|
||||||
typedef FastVector<sharedFactor> Factors;
|
typedef FastVector<sharedFactor> Factors;
|
||||||
typedef FastVector<boost::shared_ptr<Cluster> > Children;
|
typedef FastVector<boost::shared_ptr<Cluster> > Children;
|
||||||
|
|
||||||
Keys keys; ///< Frontal keys of this node
|
Keys orderedFrontalKeys; ///< Frontal keys of this node
|
||||||
Factors factors; ///< Factors associated with this node
|
Factors factors; ///< Factors associated with this node
|
||||||
Children children; ///< sub-trees
|
Children children; ///< sub-trees
|
||||||
int problemSize_;
|
int problemSize_;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace gtsam {
|
||||||
// structure with its own JT node, and create a child pointer in its parent.
|
// structure with its own JT node, and create a child pointer in its parent.
|
||||||
ConstructorTraversalData<BAYESTREE,GRAPH> myData = ConstructorTraversalData<BAYESTREE,GRAPH>(&parentData);
|
ConstructorTraversalData<BAYESTREE,GRAPH> myData = ConstructorTraversalData<BAYESTREE,GRAPH>(&parentData);
|
||||||
myData.myJTNode = boost::make_shared<typename JunctionTree<BAYESTREE,GRAPH>::Node>();
|
myData.myJTNode = boost::make_shared<typename JunctionTree<BAYESTREE,GRAPH>::Node>();
|
||||||
myData.myJTNode->keys.push_back(node->key);
|
myData.myJTNode->orderedFrontalKeys.push_back(node->key);
|
||||||
myData.myJTNode->factors.insert(myData.myJTNode->factors.begin(), node->factors.begin(), node->factors.end());
|
myData.myJTNode->factors.insert(myData.myJTNode->factors.begin(), node->factors.begin(), node->factors.end());
|
||||||
parentData.myJTNode->children.push_back(myData.myJTNode);
|
parentData.myJTNode->children.push_back(myData.myJTNode);
|
||||||
return myData;
|
return myData;
|
||||||
|
|
@ -101,13 +101,20 @@ namespace gtsam {
|
||||||
const typename JunctionTree<BAYESTREE, GRAPH>::Node& childToMerge =
|
const typename JunctionTree<BAYESTREE, GRAPH>::Node& childToMerge =
|
||||||
*myData.myJTNode->children[child - nrMergedChildren];
|
*myData.myJTNode->children[child - nrMergedChildren];
|
||||||
// Merge keys, factors, and children.
|
// Merge keys, factors, and children.
|
||||||
myData.myJTNode->keys.insert(myData.myJTNode->keys.begin(), childToMerge.keys.begin(), childToMerge.keys.end());
|
myData.myJTNode->orderedFrontalKeys.insert(
|
||||||
myData.myJTNode->factors.insert(myData.myJTNode->factors.end(), childToMerge.factors.begin(), childToMerge.factors.end());
|
myData.myJTNode->orderedFrontalKeys.begin(),
|
||||||
myData.myJTNode->children.insert(myData.myJTNode->children.end(), childToMerge.children.begin(), childToMerge.children.end());
|
childToMerge.orderedFrontalKeys.begin(),
|
||||||
|
childToMerge.orderedFrontalKeys.end());
|
||||||
|
myData.myJTNode->factors.insert(myData.myJTNode->factors.end(),
|
||||||
|
childToMerge.factors.begin(),
|
||||||
|
childToMerge.factors.end());
|
||||||
|
myData.myJTNode->children.insert(myData.myJTNode->children.end(),
|
||||||
|
childToMerge.children.begin(),
|
||||||
|
childToMerge.children.end());
|
||||||
// Increment problem size
|
// Increment problem size
|
||||||
combinedProblemSize = std::max(combinedProblemSize, childToMerge.problemSize_);
|
combinedProblemSize = std::max(combinedProblemSize, childToMerge.problemSize_);
|
||||||
// Increment number of frontal variables
|
// Increment number of frontal variables
|
||||||
myNrFrontals += childToMerge.keys.size();
|
myNrFrontals += childToMerge.orderedFrontalKeys.size();
|
||||||
// Remove child from list.
|
// Remove child from list.
|
||||||
myData.myJTNode->children.erase(myData.myJTNode->children.begin() + (child - nrMergedChildren));
|
myData.myJTNode->children.erase(myData.myJTNode->children.begin() + (child - nrMergedChildren));
|
||||||
// Increment number of merged children
|
// Increment number of merged children
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,10 @@ TEST( JunctionTree, constructor )
|
||||||
frontal1 = list_of(2)(3),
|
frontal1 = list_of(2)(3),
|
||||||
frontal2 = list_of(0)(1),
|
frontal2 = list_of(0)(1),
|
||||||
sep1, sep2 = list_of(2);
|
sep1, sep2 = list_of(2);
|
||||||
EXPECT(assert_container_equality(frontal1, actual.roots().front()->keys));
|
EXPECT(assert_container_equality(frontal1, actual.roots().front()->orderedFrontalKeys));
|
||||||
//EXPECT(assert_equal(sep1, actual.roots().front()->separator));
|
//EXPECT(assert_equal(sep1, actual.roots().front()->separator));
|
||||||
LONGS_EQUAL(1, (long)actual.roots().front()->factors.size());
|
LONGS_EQUAL(1, (long)actual.roots().front()->factors.size());
|
||||||
EXPECT(assert_container_equality(frontal2, actual.roots().front()->children.front()->keys));
|
EXPECT(assert_container_equality(frontal2, actual.roots().front()->children.front()->orderedFrontalKeys));
|
||||||
//EXPECT(assert_equal(sep2, actual.roots().front()->children.front()->separator));
|
//EXPECT(assert_equal(sep2, actual.roots().front()->children.front()->separator));
|
||||||
LONGS_EQUAL(2, (long)actual.roots().front()->children.front()->factors.size());
|
LONGS_EQUAL(2, (long)actual.roots().front()->children.front()->factors.size());
|
||||||
EXPECT(assert_equal(*simpleChain[2], *actual.roots().front()->factors[0]));
|
EXPECT(assert_equal(*simpleChain[2], *actual.roots().front()->factors[0]));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue