Removed obsolete optimize call and documented better
parent
4d9ff77249
commit
626d06905c
|
@ -474,6 +474,14 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testChordalBayesNet.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testChordalBayesNet.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>install</buildTarget>
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#include <stdarg.h>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#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<VectorConfig> ChordalBayesNet::optimize() const
|
||||
{
|
||||
boost::shared_ptr<VectorConfig> result(new VectorConfig);
|
||||
result = optimize(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
boost::shared_ptr<VectorConfig> ChordalBayesNet::optimize(const boost::shared_ptr<VectorConfig> &c) const
|
||||
{
|
||||
boost::shared_ptr<VectorConfig> 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;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <boost/serialization/list.hpp>
|
||||
|
||||
#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<VectorConfig> optimize() const;
|
||||
boost::shared_ptr<VectorConfig> optimize(const boost::shared_ptr<VectorConfig> &c) const;
|
||||
|
||||
/** size is the number of nodes */
|
||||
size_t size() const {return nodes.size();}
|
||||
|
|
Loading…
Reference in New Issue