small improvements

release/4.3a0
Varun Agrawal 2023-07-03 16:40:27 -04:00
parent 59e26ee79d
commit f6d42d0ee0
3 changed files with 10 additions and 6 deletions

View File

@ -147,6 +147,9 @@ namespace gtsam {
/// @name Advanced Interface
/// @{
/// Inherit all the `apply` methods from AlgebraicDecisionTree
using ADT::apply;
/**
* Apply binary operator (*this) "op" f
* @param f the second argument for op

View File

@ -155,18 +155,18 @@ void HybridBayesNet::updateDiscreteConditionals(
auto discrete = conditional->asDiscrete();
// Convert pointer from conditional to factor
auto discreteTree =
std::dynamic_pointer_cast<DecisionTreeFactor::ADT>(discrete);
auto discreteFactor =
std::dynamic_pointer_cast<DecisionTreeFactor>(discrete);
// Apply prunerFunc to the underlying AlgebraicDecisionTree
DecisionTreeFactor::ADT prunedDiscreteTree =
discreteTree->apply(prunerFunc(prunedDiscreteProbs, *conditional));
DecisionTreeFactor::ADT prunedDiscreteFactor =
discreteFactor->apply(prunerFunc(prunedDiscreteProbs, *conditional));
gttic_(HybridBayesNet_MakeConditional);
// Create the new (hybrid) conditional
KeyVector frontals(discrete->frontals().begin(),
discrete->frontals().end());
auto prunedDiscrete = std::make_shared<DiscreteLookupTable>(
frontals.size(), conditional->discreteKeys(), prunedDiscreteTree);
frontals.size(), conditional->discreteKeys(), prunedDiscreteFactor);
conditional = std::make_shared<HybridConditional>(prunedDiscrete);
gttoc_(HybridBayesNet_MakeConditional);

View File

@ -72,7 +72,8 @@ void HybridSmoother::update(HybridGaussianFactorGraph graph,
addConditionals(graph, hybridBayesNet_, ordering);
// Eliminate.
auto bayesNetFragment = graph.eliminateSequential(ordering);
HybridBayesNet::shared_ptr bayesNetFragment =
graph.eliminateSequential(ordering);
/// Prune
if (maxNrLeaves) {