From f7071298c3b63bda597b7e6c9e33740ea62f1381 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 13 Jul 2023 16:06:16 -0400 Subject: [PATCH] small improvements to comments and code structure --- gtsam/hybrid/HybridBayesNet.cpp | 7 +++---- gtsam/hybrid/HybridSmoother.cpp | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gtsam/hybrid/HybridBayesNet.cpp b/gtsam/hybrid/HybridBayesNet.cpp index 3b5ab5b80..ff2752bcb 100644 --- a/gtsam/hybrid/HybridBayesNet.cpp +++ b/gtsam/hybrid/HybridBayesNet.cpp @@ -39,8 +39,7 @@ bool HybridBayesNet::equals(const This &bn, double tol) const { /* ************************************************************************* */ DiscreteConditional::shared_ptr HybridBayesNet::discreteConditionals() const { - // The canonical decision tree factor which will get - // the discrete conditionals added to it. + // The joint discrete probability. DiscreteConditional discreteProbs; for (auto &&conditional : *this) { @@ -152,7 +151,7 @@ void HybridBayesNet::updateDiscreteConditionals( // Convert pointer from conditional to factor auto discreteFactor = std::dynamic_pointer_cast(discrete); - // Apply prunerFunc to the underlying AlgebraicDecisionTree + // Apply prunerFunc to the underlying conditional DecisionTreeFactor::ADT prunedDiscreteFactor = discreteFactor->apply(prunerFunc(prunedDiscreteProbs, *conditional)); @@ -173,7 +172,7 @@ void HybridBayesNet::updateDiscreteConditionals( /* ************************************************************************* */ HybridBayesNet HybridBayesNet::prune(size_t maxNrLeaves) { - // Get the decision tree of only the discrete keys + // Get the joint distribution of only the discrete keys gttic_(HybridBayesNet_PruneDiscreteConditionals); DiscreteConditional::shared_ptr discreteConditionals = this->discreteConditionals(); diff --git a/gtsam/hybrid/HybridSmoother.cpp b/gtsam/hybrid/HybridSmoother.cpp index 27d3f70fc..afa8340d2 100644 --- a/gtsam/hybrid/HybridSmoother.cpp +++ b/gtsam/hybrid/HybridSmoother.cpp @@ -97,7 +97,8 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &originalGraph, HybridGaussianFactorGraph graph(originalGraph); HybridBayesNet hybridBayesNet(originalHybridBayesNet); - // If we are not at the first iteration, means we have conditionals to add. + // If hybridBayesNet is not empty, + // it means we have conditionals to add to the factor graph. if (!hybridBayesNet.empty()) { // We add all relevant conditional mixtures on the last continuous variable // in the previous `hybridBayesNet` to the graph