Fixed iSAM2 deep copy of empty tree

release/4.3a0
Richard Roberts 2012-04-09 03:02:11 +00:00
parent 4c58a00a6d
commit 2ac1473a84
3 changed files with 13 additions and 3 deletions

View File

@ -582,6 +582,13 @@ namespace gtsam {
}
}
/* ************************************************************************* */
template<class CONDITIONAL, class CLIQUE>
void BayesTree<CONDITIONAL,CLIQUE>::cloneTo(This& newTree) const {
if(root())
cloneTo(newTree, root(), sharedClique());
}
/* ************************************************************************* */
template<class CONDITIONAL, class CLIQUE>
void BayesTree<CONDITIONAL,CLIQUE>::cloneTo(

View File

@ -283,9 +283,7 @@ namespace gtsam {
private:
/** deep copy to another tree */
void cloneTo(This& newTree) const {
cloneTo(newTree, root(), sharedClique());
}
void cloneTo(This& newTree) const;
/** deep copy to another tree */
void cloneTo(This& newTree, const sharedClique& subtree, const sharedClique& parent) const;

View File

@ -898,6 +898,11 @@ TEST(ISAM2, clone) {
CHECK(assert_equal(createSlamlikeISAM2(), clone1));
CHECK(assert_equal(clone1, temp));
// Check clone empty
ISAM2 isam;
clone1 = isam;
CHECK(assert_equal(ISAM2(), clone1));
}
/* ************************************************************************* */