| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @file    Ordering.cpp | 
					
						
							|  |  |  |  * @brief   Ordering | 
					
						
							|  |  |  |  * @author  Christian Potthast | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <iostream>
 | 
					
						
							| 
									
										
										
										
											2010-01-07 16:00:54 +08:00
										 |  |  | #include <stdexcept>
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:24:22 +08:00
										 |  |  | #include <boost/foreach.hpp>
 | 
					
						
							| 
									
										
										
										
											2010-01-07 16:00:54 +08:00
										 |  |  | #include <boost/tuple/tuple.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | #include "Ordering.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using namespace std; | 
					
						
							|  |  |  | using namespace gtsam; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2009-10-31 23:24:22 +08:00
										 |  |  | void Ordering::print(const string& s) const { | 
					
						
							| 
									
										
										
										
											2010-01-16 12:22:21 +08:00
										 |  |  |   cout << s << " (" << size() << "):"; | 
					
						
							| 
									
										
										
										
											2010-01-18 03:34:57 +08:00
										 |  |  |   BOOST_FOREACH(const Symbol& key, *this) | 
					
						
							|  |  |  |     cout << " " << (string)key; | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  |   cout << endl; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2009-10-31 23:24:22 +08:00
										 |  |  | bool Ordering::equals(const Ordering &other, double tol) const { | 
					
						
							|  |  |  | 	return *this == other; | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-01-07 16:00:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-19 03:11:22 +08:00
										 |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | Ordering Ordering::subtract(const Ordering& keys) const { | 
					
						
							|  |  |  | 	Ordering newOrdering = *this; | 
					
						
							|  |  |  | 	BOOST_FOREACH(const Symbol& key, keys) { | 
					
						
							|  |  |  | 		newOrdering.remove(key); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return newOrdering; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ |