incremental nonlinear working
parent
b860f06614
commit
ecde508318
|
|
@ -262,6 +262,20 @@ namespace gtsam {
|
|||
equal(nodes_.begin(),nodes_.end(),other.nodes_.begin(),check_pair<Conditional>);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class Conditional>
|
||||
Symbol BayesTree<Conditional>::findParentClique(const list<Symbol>& parents, const list<Symbol>& ordering) const {
|
||||
Symbol parent;
|
||||
for (list<Symbol>::const_iterator it = ordering.begin(); it!=ordering.end(); it++) {
|
||||
list<Symbol>::const_iterator pit = find(parents.begin(), parents.end(), *it);
|
||||
if (pit!=parents.end()) {
|
||||
parent = *pit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class Conditional>
|
||||
void BayesTree<Conditional>::insert(const sharedConditional& conditional, const list<Symbol>* ordering)
|
||||
|
|
@ -281,13 +295,7 @@ namespace gtsam {
|
|||
if (!ordering) {
|
||||
parent = parents.front(); // assumes parents are in current variable order, which is not the case (after COLAMD was activated)
|
||||
} else {
|
||||
for (list<Symbol>::const_iterator it = ordering->begin(); it!=ordering->end(); it++) {
|
||||
list<Symbol>::iterator pit = find(parents.begin(), parents.end(), *it);
|
||||
if (pit!=parents.end()) {
|
||||
parent = *pit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
parent = findParentClique(parents, *ordering);
|
||||
}
|
||||
sharedClique parent_clique = (*this)[parent];
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@ namespace gtsam {
|
|||
/** check equality */
|
||||
bool equals(const BayesTree<Conditional>& other, double tol = 1e-9) const;
|
||||
|
||||
/** find parent clique of a conditional, given an ordering */
|
||||
Symbol findParentClique(const std::list<Symbol>& parents, const std::list<Symbol>& ordering) const;
|
||||
|
||||
/** insert a new conditional */
|
||||
void insert(const sharedConditional& conditional, const std::list<Symbol>* ordering = NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ namespace gtsam {
|
|||
FactorGraph<GaussianFactor> affectedFactors;
|
||||
list<Symbol> newFactorsKeys = newFactors.keys();
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
|
||||
// relinearize all keys that are in newFactors, and already exist (not new variables!)
|
||||
list<Symbol> keysToRelinearize;
|
||||
|
|
@ -237,7 +237,8 @@ namespace gtsam {
|
|||
// add orphans to the bottom of the new tree
|
||||
BOOST_FOREACH(sharedClique orphan, orphans) {
|
||||
|
||||
Symbol key = orphan->separator_.front();
|
||||
// Symbol key = orphan->separator_.front();
|
||||
Symbol key = findParentClique(orphan->separator_, ordering);
|
||||
sharedClique parent = (*this)[key];
|
||||
|
||||
parent->children_ += orphan;
|
||||
|
|
|
|||
Loading…
Reference in New Issue