From 626d06905cf18e7d4f80483adf81141372a9b530 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Tue, 27 Oct 2009 14:14:36 +0000 Subject: [PATCH] Removed obsolete optimize call and documented better --- .cproject | 8 ++++++++ cpp/ChordalBayesNet.cpp | 21 ++++++--------------- cpp/ChordalBayesNet.h | 6 +++--- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.cproject b/.cproject index 74da432e0..b7c7c5027 100644 --- a/.cproject +++ b/.cproject @@ -474,6 +474,14 @@ true true + +make + +testChordalBayesNet.run +true +true +true + make install diff --git a/cpp/ChordalBayesNet.cpp b/cpp/ChordalBayesNet.cpp index f709bf87a..750fdcfd9 100644 --- a/cpp/ChordalBayesNet.cpp +++ b/cpp/ChordalBayesNet.cpp @@ -7,7 +7,9 @@ #include #include #include + #include "ChordalBayesNet.h" +#include "VectorConfig.h" using namespace std; using namespace gtsam; @@ -58,28 +60,17 @@ void ChordalBayesNet::erase(const string& key) nodes.erase(key); } -/* ************************************************************************* */ -// optimize, i.e. return x = inv(R)*d /* ************************************************************************* */ boost::shared_ptr ChordalBayesNet::optimize() const { boost::shared_ptr result(new VectorConfig); - result = optimize(result); - return result; -} - -/* ************************************************************************* */ -boost::shared_ptr ChordalBayesNet::optimize(const boost::shared_ptr &c) const -{ - boost::shared_ptr result(new VectorConfig); - result = c; /** solve each node in turn in topological sort order (parents first)*/ BOOST_FOREACH(string key, keys) { - const_iterator cg = nodes.find(key); // get node - assert( cg != nodes.end() ); - Vector x = cg->second->solve(*result); // Solve it - result->insert(key,x); // store result in partial solution + const_iterator cg = nodes.find(key); // get node + assert( cg != nodes.end() ); // make sure it exists + Vector x = cg->second->solve(*result); // Solve for that variable + result->insert(key,x); // store result in partial solution } return result; } diff --git a/cpp/ChordalBayesNet.h b/cpp/ChordalBayesNet.h index ea1fbd8a3..56380cabb 100644 --- a/cpp/ChordalBayesNet.h +++ b/cpp/ChordalBayesNet.h @@ -14,7 +14,6 @@ #include #include "ConditionalGaussian.h" -#include "VectorConfig.h" #include "Testable.h" namespace gtsam { @@ -77,9 +76,10 @@ public: const_iterator const begin() const {return nodes.begin();} const_iterator const end() const {return nodes.end();} - /** optimize */ + /** + * optimize, i.e. return x = inv(R)*d + */ boost::shared_ptr optimize() const; - boost::shared_ptr optimize(const boost::shared_ptr &c) const; /** size is the number of nodes */ size_t size() const {return nodes.size();}