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();}