Fixed tests
							parent
							
								
									9cf3e5c26a
								
							
						
					
					
						commit
						beda6878aa
					
				|  | @ -206,9 +206,8 @@ hybridElimination(const HybridGaussianFactorGraph &factors, | ||||||
|   }; |   }; | ||||||
|   sum = GaussianMixtureFactor::Sum(sum, emptyGaussian); |   sum = GaussianMixtureFactor::Sum(sum, emptyGaussian); | ||||||
| 
 | 
 | ||||||
|   using EliminationPair = |   using EliminationPair = std::pair<boost::shared_ptr<GaussianConditional>, | ||||||
|       std::pair<boost::shared_ptr<GaussianConditional>, |                                     GaussianMixtureFactor::FactorAndConstant>; | ||||||
|                 std::pair<boost::shared_ptr<GaussianFactor>, double>>; |  | ||||||
| 
 | 
 | ||||||
|   KeyVector keysOfEliminated;  // Not the ordering
 |   KeyVector keysOfEliminated;  // Not the ordering
 | ||||||
|   KeyVector keysOfSeparator;   // TODO(frank): Is this just (keys - ordering)?
 |   KeyVector keysOfSeparator;   // TODO(frank): Is this just (keys - ordering)?
 | ||||||
|  | @ -216,7 +215,7 @@ hybridElimination(const HybridGaussianFactorGraph &factors, | ||||||
|   // This is the elimination method on the leaf nodes
 |   // This is the elimination method on the leaf nodes
 | ||||||
|   auto eliminate = [&](const GaussianFactorGraph &graph) -> EliminationPair { |   auto eliminate = [&](const GaussianFactorGraph &graph) -> EliminationPair { | ||||||
|     if (graph.empty()) { |     if (graph.empty()) { | ||||||
|       return {nullptr, std::make_pair(nullptr, 0.0)}; |       return {nullptr, {nullptr, 0.0}}; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #ifdef HYBRID_TIMING | #ifdef HYBRID_TIMING | ||||||
|  | @ -236,11 +235,7 @@ hybridElimination(const HybridGaussianFactorGraph &factors, | ||||||
|     gttoc_(hybrid_eliminate); |     gttoc_(hybrid_eliminate); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     std::pair<boost::shared_ptr<GaussianConditional>, |     return {conditional_factor.first, {conditional_factor.second, 0.0}}; | ||||||
|               std::pair<boost::shared_ptr<GaussianFactor>, double>> |  | ||||||
|         result = std::make_pair(conditional_factor.first, |  | ||||||
|                                 std::make_pair(conditional_factor.second, 0.0)); |  | ||||||
|     return result; |  | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   // Perform elimination!
 |   // Perform elimination!
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ | ||||||
| /**
 | /**
 | ||||||
|  * @file   HybridGaussianFactorGraph.h |  * @file   HybridGaussianFactorGraph.h | ||||||
|  * @brief  Linearized Hybrid factor graph that uses type erasure |  * @brief  Linearized Hybrid factor graph that uses type erasure | ||||||
|  * @author Fan Jiang, Varun Agrawal |  * @author Fan Jiang, Varun Agrawal, Frank Dellaert | ||||||
|  * @date   Mar 11, 2022 |  * @date   Mar 11, 2022 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | @ -38,6 +38,7 @@ class HybridBayesTree; | ||||||
| class HybridJunctionTree; | class HybridJunctionTree; | ||||||
| class DecisionTreeFactor; | class DecisionTreeFactor; | ||||||
| class JacobianFactor; | class JacobianFactor; | ||||||
|  | class HybridValues; | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * @brief Main elimination function for HybridGaussianFactorGraph. |  * @brief Main elimination function for HybridGaussianFactorGraph. | ||||||
|  |  | ||||||
|  | @ -128,9 +128,9 @@ TEST(GaussianMixture, Error) { | ||||||
|   // Regression for non-tree version.
 |   // Regression for non-tree version.
 | ||||||
|   DiscreteValues assignment; |   DiscreteValues assignment; | ||||||
|   assignment[M(1)] = 0; |   assignment[M(1)] = 0; | ||||||
|   EXPECT_DOUBLES_EQUAL(0.5, mixture.error(values, assignment), 1e-8); |   EXPECT_DOUBLES_EQUAL(0.5, mixture.error({values, assignment}), 1e-8); | ||||||
|   assignment[M(1)] = 1; |   assignment[M(1)] = 1; | ||||||
|   EXPECT_DOUBLES_EQUAL(4.3252595155709335, mixture.error(values, assignment), |   EXPECT_DOUBLES_EQUAL(4.3252595155709335, mixture.error({values, assignment}), | ||||||
|                        1e-8); |                        1e-8); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -188,7 +188,7 @@ TEST(GaussianMixtureFactor, Error) { | ||||||
|   DiscreteValues discreteValues; |   DiscreteValues discreteValues; | ||||||
|   discreteValues[m1.first] = 1; |   discreteValues[m1.first] = 1; | ||||||
|   EXPECT_DOUBLES_EQUAL( |   EXPECT_DOUBLES_EQUAL( | ||||||
|       4.0, mixtureFactor.error(continuousValues, discreteValues), 1e-9); |       4.0, mixtureFactor.error({continuousValues, discreteValues}), 1e-9); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* ************************************************************************* */ | /* ************************************************************************* */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue