Commented marginalGaussian() due to compile error
parent
5f8b0e9341
commit
4ae9b72a35
|
|
@ -85,36 +85,36 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
pair<Vector,Matrix> marginalGaussian(const GaussianFactorGraph& fg, const Symbol& key) {
|
// pair<Vector,Matrix> marginalGaussian(const GaussianFactorGraph& fg, const Symbol& key) {
|
||||||
|
//
|
||||||
// todo: this does not use colamd!
|
// // todo: this does not use colamd!
|
||||||
|
//
|
||||||
list<Symbol> ord;
|
// list<Symbol> ord;
|
||||||
BOOST_FOREACH(const Symbol& k, fg.keys()) {
|
// BOOST_FOREACH(const Symbol& k, fg.keys()) {
|
||||||
if(k != key)
|
// if(k != key)
|
||||||
ord.push_back(k);
|
// ord.push_back(k);
|
||||||
}
|
// }
|
||||||
Ordering ordering(ord);
|
// Ordering ordering(ord);
|
||||||
|
//
|
||||||
// Now make another factor graph where we eliminate all the other variables
|
// // Now make another factor graph where we eliminate all the other variables
|
||||||
GaussianFactorGraph marginal(fg);
|
// GaussianFactorGraph marginal(fg);
|
||||||
marginal.eliminate(ordering);
|
// marginal.eliminate(ordering);
|
||||||
|
//
|
||||||
GaussianFactor::shared_ptr factor;
|
// GaussianFactor::shared_ptr factor;
|
||||||
for(size_t i=0; i<marginal.size(); i++)
|
// for(size_t i=0; i<marginal.size(); i++)
|
||||||
if(marginal[i] != NULL) {
|
// if(marginal[i] != NULL) {
|
||||||
factor = marginal[i];
|
// factor = marginal[i];
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(factor->keys().size() != 1 || factor->keys().front() != key)
|
// if(factor->keys().size() != 1 || factor->keys().front() != key)
|
||||||
throw runtime_error("Didn't get the right marginal!");
|
// throw runtime_error("Didn't get the right marginal!");
|
||||||
|
//
|
||||||
VectorConfig mean_cfg(marginal.optimize(Ordering(key)));
|
// VectorConfig mean_cfg(marginal.optimize(Ordering(key)));
|
||||||
Matrix A(factor->get_A(key));
|
// Matrix A(factor->get_A(key));
|
||||||
|
//
|
||||||
return make_pair(mean_cfg[key], inverse(trans(A)*A));
|
// return make_pair(mean_cfg[key], inverse(prod(trans(A), A)));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,6 @@ namespace gtsam {
|
||||||
* Hacked-together function to compute a Gaussian marginal for the given variable.
|
* Hacked-together function to compute a Gaussian marginal for the given variable.
|
||||||
* todo: This is inefficient!
|
* todo: This is inefficient!
|
||||||
*/
|
*/
|
||||||
std::pair<Vector,Matrix> marginalGaussian(const GaussianFactorGraph& fg, const Symbol& key);
|
//std::pair<Vector,Matrix> marginalGaussian(const GaussianFactorGraph& fg, const Symbol& key);
|
||||||
|
|
||||||
} /// namespace gtsam
|
} /// namespace gtsam
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue