| 
									
										
										
										
											2010-10-23 02:02:55 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation, | 
					
						
							|  |  |  |  * Atlanta, Georgia 30332-0415 | 
					
						
							|  |  |  |  * All Rights Reserved | 
					
						
							|  |  |  |  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * See LICENSE for the license information | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-22 07:04:42 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @file    GenericMultifrontalSolver-inl.h | 
					
						
							|  |  |  |  * @brief    | 
					
						
							|  |  |  |  * @author  Richard Roberts | 
					
						
							|  |  |  |  * @created Oct 21, 2010 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <gtsam/inference/GenericMultifrontalSolver.h>
 | 
					
						
							| 
									
										
										
										
											2010-10-23 02:02:55 +08:00
										 |  |  | #include <gtsam/inference/FactorBase-inl.h>
 | 
					
						
							| 
									
										
										
										
											2010-10-22 07:04:42 +08:00
										 |  |  | #include <gtsam/inference/JunctionTree-inl.h>
 | 
					
						
							|  |  |  | #include <gtsam/inference/BayesNet-inl.h>
 | 
					
						
							|  |  |  | #include <gtsam/inference/inference-inl.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <boost/foreach.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace gtsam { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2010-10-23 02:02:55 +08:00
										 |  |  | template<class FACTOR, class JUNCTIONTREE> | 
					
						
							|  |  |  | GenericMultifrontalSolver<FACTOR, JUNCTIONTREE>::GenericMultifrontalSolver(const FactorGraph<FACTOR>& factorGraph) : | 
					
						
							|  |  |  |     junctionTree_(factorGraph) {} | 
					
						
							| 
									
										
										
										
											2010-10-22 07:04:42 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2010-10-23 02:02:55 +08:00
										 |  |  | template<class FACTOR, class JUNCTIONTREE> | 
					
						
							|  |  |  | typename JUNCTIONTREE::BayesTree::shared_ptr | 
					
						
							|  |  |  | GenericMultifrontalSolver<FACTOR, JUNCTIONTREE>::eliminate() const { | 
					
						
							|  |  |  |   typename JUNCTIONTREE::BayesTree::shared_ptr bayesTree(new typename JUNCTIONTREE::BayesTree); | 
					
						
							|  |  |  |   bayesTree->insert(junctionTree_.eliminate()); | 
					
						
							|  |  |  |   return bayesTree; | 
					
						
							| 
									
										
										
										
											2010-10-22 07:04:42 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2010-10-23 02:02:55 +08:00
										 |  |  | template<class FACTOR, class JUNCTIONTREE> | 
					
						
							|  |  |  | typename FACTOR::shared_ptr GenericMultifrontalSolver<FACTOR, JUNCTIONTREE>::marginal(Index j) const { | 
					
						
							| 
									
										
										
										
											2010-10-22 08:06:54 +08:00
										 |  |  |   return eliminate()->marginal(j); | 
					
						
							| 
									
										
										
										
											2010-10-22 07:04:42 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |