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