From d1b8925617a9f2cbe610b5cb38a20c61a7a977d9 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 8 Nov 2009 04:39:54 +0000 Subject: [PATCH] Construct symbolic version of any Bayes net --- cpp/SymbolicBayesNet.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cpp/SymbolicBayesNet.h b/cpp/SymbolicBayesNet.h index fe47c5894..98a5b6c99 100644 --- a/cpp/SymbolicBayesNet.h +++ b/cpp/SymbolicBayesNet.h @@ -35,6 +35,21 @@ namespace gtsam { */ SymbolicBayesNet() {} + /** + * Construct from a Bayes net of any type + */ + template + SymbolicBayesNet(const BayesNet& bn) { + typename BayesNet::const_iterator it = bn.begin(); + for(;it!=bn.end();it++) { + boost::shared_ptr conditional = *it; + std::string key = conditional->key(); + std::list parents = conditional->parents(); + SymbolicConditional::shared_ptr c(new SymbolicConditional(key,parents)); + push_back(c); + } + } + /** Destructor */ virtual ~SymbolicBayesNet() { }