| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * TupleConfig-inl.h | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  Created on: Jan 14, 2010 | 
					
						
							|  |  |  |  *      Author: richard | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-05 01:15:09 +08:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | #include <iostream>
 | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | #include "LieConfig-inl.h"
 | 
					
						
							|  |  |  | #include "TupleConfig.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define INSTANTIATE_PAIR_CONFIG(J1,X1,J2,X2) \
 | 
					
						
							|  |  |  |   /*INSTANTIATE_LIE_CONFIG(J1,X1);*/ \ | 
					
						
							|  |  |  |   /*INSTANTIATE_LIE_CONFIG(J2,X2);*/ \ | 
					
						
							|  |  |  |   template class PairConfig<J1,X1,J2,X2>; \ | 
					
						
							|  |  |  |   /*template void PairConfig<J1,X1,J2,X2>::print(const std::string&) const;*/ \ | 
					
						
							| 
									
										
										
										
											2010-03-11 00:30:00 +08:00
										 |  |  |   template PairConfig<J1,X1,J2,X2> expmap(const PairConfig<J1,X1,J2,X2>&, const VectorConfig&); | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-09 06:29:00 +08:00
										 |  |  | // TupleConfig instantiations for N = 1-6
 | 
					
						
							|  |  |  | #define INSTANTIATE_TUPLE_CONFIG2(Config1, Config2) \
 | 
					
						
							| 
									
										
										
										
											2010-02-09 09:24:41 +08:00
										 |  |  | 		template class TupleConfig2<Config1, Config2>; | 
					
						
							| 
									
										
										
										
											2010-02-09 06:29:00 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define INSTANTIATE_TUPLE_CONFIG3(Config1, Config2, Config3) \
 | 
					
						
							| 
									
										
										
										
											2010-02-09 09:24:41 +08:00
										 |  |  | 		template class TupleConfig3<Config1, Config2, Config3>; | 
					
						
							| 
									
										
										
										
											2010-02-09 06:29:00 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define INSTANTIATE_TUPLE_CONFIG4(Config1, Config2, Config3, Config4) \
 | 
					
						
							| 
									
										
										
										
											2010-02-09 09:24:41 +08:00
										 |  |  | 		template class TupleConfig4<Config1, Config2, Config3, Config4>; | 
					
						
							| 
									
										
										
										
											2010-02-09 06:29:00 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define INSTANTIATE_TUPLE_CONFIG5(Config1, Config2, Config3, Config4, Config5) \
 | 
					
						
							| 
									
										
										
										
											2010-02-09 09:24:41 +08:00
										 |  |  | 		template class TupleConfig5<Config1, Config2, Config3, Config4, Config5>; | 
					
						
							| 
									
										
										
										
											2010-02-09 06:29:00 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define INSTANTIATE_TUPLE_CONFIG6(Config1, Config2, Config3, Config4, Config5, Config6) \
 | 
					
						
							| 
									
										
										
										
											2010-02-09 09:24:41 +08:00
										 |  |  | 		template class TupleConfig6<Config1, Config2, Config3, Config4, Config5, Config6>; | 
					
						
							| 
									
										
										
										
											2010-02-09 06:29:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-09 04:53:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | namespace gtsam { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | /** PairConfig implementations */ | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | template<class J1, class X1, class J2, class X2> | 
					
						
							|  |  |  | void PairConfig<J1,X1,J2,X2>::print(const std::string& s) const { | 
					
						
							| 
									
										
										
										
											2010-03-07 14:16:49 +08:00
										 |  |  | 	std::cout << "TupleConfig " << s << ", size " << size() << "\n"; | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 	first().print(s + "Config1: "); | 
					
						
							|  |  |  | 	second().print(s + "Config2: "); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | template<class J1, class X1, class J2, class X2> | 
					
						
							|  |  |  | void PairConfig<J1,X1,J2,X2>::insert(const PairConfig& config) { | 
					
						
							|  |  |  | 	for (typename Config1::const_iterator it = config.first().begin(); it!=config.first().end(); it++) { | 
					
						
							|  |  |  | 		insert(it->first, it->second); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	for (typename Config2::const_iterator it = config.second().begin(); it!=config.second().end(); it++) { | 
					
						
							|  |  |  | 		insert(it->first, it->second); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | /** TupleConfig Implementations */ | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<class Config1, class Config2> | 
					
						
							|  |  |  | void TupleConfig<Config1, Config2>::print(const std::string& s) const { | 
					
						
							|  |  |  | 	std::cout << s << " : " << std::endl; | 
					
						
							|  |  |  | 	first_.print(); | 
					
						
							|  |  |  | 	second_.print(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<class Config1> | 
					
						
							|  |  |  | void TupleConfigEnd<Config1>::print(const std::string& s ) const { | 
					
						
							|  |  |  | 	first_.print(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | /** TupleConfigN Implementations */ | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | /** TupleConfig 2 */ | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | template<class Config1, class Config2> | 
					
						
							|  |  |  | TupleConfig2<Config1, Config2>::TupleConfig2(const TupleConfig2<Config1, Config2>& config) : | 
					
						
							|  |  |  | 		  TupleConfig<Config1, TupleConfigEnd<Config2> >(config) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<class Config1, class Config2> | 
					
						
							|  |  |  | TupleConfig2<Config1, Config2>::TupleConfig2(const Config1& cfg1, const Config2& cfg2) : | 
					
						
							|  |  |  | 			  TupleConfig<Config1, TupleConfigEnd<Config2> >( | 
					
						
							|  |  |  | 					  cfg1, TupleConfigEnd<Config2>(cfg2)) {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | template<class Config1, class Config2> | 
					
						
							|  |  |  | TupleConfig2<Config1, Config2>::TupleConfig2(const TupleConfig<Config1, TupleConfigEnd<Config2> >& config) : | 
					
						
							|  |  |  | 	TupleConfig<Config1, TupleConfigEnd<Config2> >(config) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | /** TupleConfig 3 */ | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | template<class Config1, class Config2, class Config3> | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | TupleConfig3<Config1, Config2, Config3>::TupleConfig3( | 
					
						
							|  |  |  | 		const TupleConfig3<Config1, Config2, Config3>& config) : | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 		  TupleConfig<Config1, TupleConfig<Config2, TupleConfigEnd<Config3> > >(config) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<class Config1, class Config2, class Config3> | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | TupleConfig3<Config1, Config2, Config3>::TupleConfig3( | 
					
						
							|  |  |  | 		const Config1& cfg1, const Config2& cfg2, const Config3& cfg3) : | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 			  TupleConfig<Config1, TupleConfig<Config2, TupleConfigEnd<Config3> > >( | 
					
						
							|  |  |  | 					  cfg1, TupleConfig<Config2, TupleConfigEnd<Config3> >( | 
					
						
							|  |  |  | 							  cfg2, TupleConfigEnd<Config3>(cfg3))) {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | template<class Config1, class Config2, class Config3> | 
					
						
							|  |  |  | TupleConfig3<Config1, Config2, Config3>::TupleConfig3( | 
					
						
							|  |  |  | 		const TupleConfig<Config1, TupleConfig<Config2, TupleConfigEnd<Config3> > >& config) : | 
					
						
							|  |  |  | 		  TupleConfig<Config1, TupleConfig<Config2, TupleConfigEnd<Config3> > >(config) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | /** TupleConfig 4 */ | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | template<class Config1, class Config2, class Config3, class Config4> | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | TupleConfig4<Config1, Config2, Config3, Config4>::TupleConfig4( | 
					
						
							|  |  |  | 		const TupleConfig4<Config1, Config2, Config3, Config4>& config) : | 
					
						
							|  |  |  | 	TupleConfig<Config1, TupleConfig<Config2, | 
					
						
							|  |  |  | 		TupleConfig<Config3, TupleConfigEnd<Config4> > > >(config) {} | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | template<class Config1, class Config2, class Config3, class Config4> | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | TupleConfig4<Config1, Config2, Config3, Config4>::TupleConfig4( | 
					
						
							|  |  |  | 		const Config1& cfg1, const Config2& cfg2, | 
					
						
							|  |  |  | 		const Config3& cfg3,const Config4& cfg4) : | 
					
						
							|  |  |  | 		  TupleConfig<Config1, TupleConfig<Config2, | 
					
						
							|  |  |  | 			  TupleConfig<Config3, TupleConfigEnd<Config4> > > >( | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 				  cfg1, TupleConfig<Config2, TupleConfig<Config3, TupleConfigEnd<Config4> > >( | 
					
						
							|  |  |  | 						  cfg2, TupleConfig<Config3, TupleConfigEnd<Config4> >( | 
					
						
							|  |  |  | 								  cfg3, TupleConfigEnd<Config4>(cfg4)))) {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | template<class Config1, class Config2, class Config3, class Config4> | 
					
						
							|  |  |  | TupleConfig4<Config1, Config2, Config3, Config4>::TupleConfig4( | 
					
						
							|  |  |  | 		const TupleConfig<Config1, TupleConfig<Config2, | 
					
						
							|  |  |  | 				TupleConfig<Config3, TupleConfigEnd<Config4> > > >& config) : | 
					
						
							|  |  |  | 	TupleConfig<Config1, TupleConfig<Config2,TupleConfig<Config3, | 
					
						
							|  |  |  | 		TupleConfigEnd<Config4> > > >(config) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | /** TupleConfig 5 */ | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | template<class Config1, class Config2, class Config3, class Config4, class Config5> | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | TupleConfig5<Config1, Config2, Config3, Config4, Config5>::TupleConfig5( | 
					
						
							|  |  |  | 		const TupleConfig5<Config1, Config2, Config3, Config4, Config5>& config) : | 
					
						
							|  |  |  | 		  TupleConfig<Config1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 			  TupleConfig<Config4, TupleConfigEnd<Config5> > > > >(config) {} | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | template<class Config1, class Config2, class Config3, class Config4, class Config5> | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | TupleConfig5<Config1, Config2, Config3, Config4, Config5>::TupleConfig5( | 
					
						
							|  |  |  | 		const Config1& cfg1, const Config2& cfg2, const Config3& cfg3, | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 				   const Config4& cfg4, const Config5& cfg5) : | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | 						   TupleConfig<Config1, TupleConfig<Config2, | 
					
						
							|  |  |  | 						   TupleConfig<Config3, TupleConfig<Config4, | 
					
						
							|  |  |  | 						   TupleConfigEnd<Config5> > > > >( | 
					
						
							|  |  |  | 								   cfg1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 										 TupleConfig<Config4, TupleConfigEnd<Config5> > > >( | 
					
						
							| 
									
										
										
										
											2010-02-05 09:33:33 +08:00
										 |  |  | 										   cfg2, TupleConfig<Config3, TupleConfig<Config4, TupleConfigEnd<Config5> > >( | 
					
						
							|  |  |  | 												   cfg3, TupleConfig<Config4, TupleConfigEnd<Config5> >( | 
					
						
							|  |  |  | 														   cfg4, TupleConfigEnd<Config5>(cfg5))))) {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-06 13:10:25 +08:00
										 |  |  | template<class Config1, class Config2, class Config3, class Config4, class Config5> | 
					
						
							|  |  |  | TupleConfig5<Config1, Config2, Config3, Config4, Config5>::TupleConfig5( | 
					
						
							|  |  |  | 		const TupleConfig<Config1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 			  TupleConfig<Config4, TupleConfigEnd<Config5> > > > >& config) : | 
					
						
							|  |  |  | 	TupleConfig<Config1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 	TupleConfig<Config4, TupleConfigEnd<Config5> > > > >(config) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | /** TupleConfig 6 */ | 
					
						
							|  |  |  | template<class Config1, class Config2, class Config3, | 
					
						
							|  |  |  | 		 class Config4, class Config5, class Config6> | 
					
						
							|  |  |  | TupleConfig6<Config1, Config2, Config3, Config4, Config5, Config6>::TupleConfig6( | 
					
						
							|  |  |  | 		const TupleConfig6<Config1, Config2, Config3, | 
					
						
							|  |  |  | 						   Config4, Config5, Config6>& config) : | 
					
						
							|  |  |  | 			  TupleConfig<Config1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 			  TupleConfig<Config4, TupleConfig<Config5, | 
					
						
							|  |  |  | 			  TupleConfigEnd<Config6> > > > > >(config) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<class Config1, class Config2, class Config3, | 
					
						
							|  |  |  | 		 class Config4, class Config5, class Config6> | 
					
						
							|  |  |  | TupleConfig6<Config1, Config2, Config3, Config4, Config5, Config6>::TupleConfig6( | 
					
						
							|  |  |  | 		const Config1& cfg1, const Config2& cfg2, const Config3& cfg3, | 
					
						
							|  |  |  | 		const Config4& cfg4, const Config5& cfg5, const Config6& cfg6) : | 
					
						
							|  |  |  | 		TupleConfig<Config1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 		TupleConfig<Config4, TupleConfig<Config5, TupleConfigEnd<Config6> > > > > >( | 
					
						
							|  |  |  | 				cfg1, TupleConfig<Config2, TupleConfig<Config3, TupleConfig<Config4, | 
					
						
							|  |  |  | 				      TupleConfig<Config5, TupleConfigEnd<Config6> > > > >( | 
					
						
							|  |  |  | 						cfg2, TupleConfig<Config3, TupleConfig<Config4, TupleConfig<Config5, | 
					
						
							|  |  |  | 							  TupleConfigEnd<Config6> > > >( | 
					
						
							|  |  |  | 								cfg3, TupleConfig<Config4, TupleConfig<Config5, | 
					
						
							|  |  |  | 								      TupleConfigEnd<Config6> > >( | 
					
						
							|  |  |  | 										cfg4, TupleConfig<Config5, TupleConfigEnd<Config6> >( | 
					
						
							|  |  |  | 												cfg5, TupleConfigEnd<Config6>(cfg6)))))) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<class Config1, class Config2, class Config3, | 
					
						
							|  |  |  | 	     class Config4, class Config5, class Config6> | 
					
						
							|  |  |  | TupleConfig6<Config1, Config2, Config3, Config4, Config5, Config6>::TupleConfig6( | 
					
						
							|  |  |  | 		const TupleConfig<Config1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 		      TupleConfig<Config4, TupleConfig<Config5, | 
					
						
							|  |  |  | 		      TupleConfigEnd<Config6> > > > > >& config) : | 
					
						
							|  |  |  | 	TupleConfig<Config1, TupleConfig<Config2, TupleConfig<Config3, | 
					
						
							|  |  |  | 	TupleConfig<Config4, TupleConfig<Config5, | 
					
						
							|  |  |  | 	TupleConfigEnd<Config6> > > > > >(config) {} | 
					
						
							| 
									
										
										
										
											2010-01-19 04:17:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | } |