small improvements
parent
59e26ee79d
commit
f6d42d0ee0
|
@ -147,6 +147,9 @@ namespace gtsam {
|
||||||
/// @name Advanced Interface
|
/// @name Advanced Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
/// Inherit all the `apply` methods from AlgebraicDecisionTree
|
||||||
|
using ADT::apply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply binary operator (*this) "op" f
|
* Apply binary operator (*this) "op" f
|
||||||
* @param f the second argument for op
|
* @param f the second argument for op
|
||||||
|
|
|
@ -155,18 +155,18 @@ void HybridBayesNet::updateDiscreteConditionals(
|
||||||
auto discrete = conditional->asDiscrete();
|
auto discrete = conditional->asDiscrete();
|
||||||
|
|
||||||
// Convert pointer from conditional to factor
|
// Convert pointer from conditional to factor
|
||||||
auto discreteTree =
|
auto discreteFactor =
|
||||||
std::dynamic_pointer_cast<DecisionTreeFactor::ADT>(discrete);
|
std::dynamic_pointer_cast<DecisionTreeFactor>(discrete);
|
||||||
// Apply prunerFunc to the underlying AlgebraicDecisionTree
|
// Apply prunerFunc to the underlying AlgebraicDecisionTree
|
||||||
DecisionTreeFactor::ADT prunedDiscreteTree =
|
DecisionTreeFactor::ADT prunedDiscreteFactor =
|
||||||
discreteTree->apply(prunerFunc(prunedDiscreteProbs, *conditional));
|
discreteFactor->apply(prunerFunc(prunedDiscreteProbs, *conditional));
|
||||||
|
|
||||||
gttic_(HybridBayesNet_MakeConditional);
|
gttic_(HybridBayesNet_MakeConditional);
|
||||||
// Create the new (hybrid) conditional
|
// Create the new (hybrid) conditional
|
||||||
KeyVector frontals(discrete->frontals().begin(),
|
KeyVector frontals(discrete->frontals().begin(),
|
||||||
discrete->frontals().end());
|
discrete->frontals().end());
|
||||||
auto prunedDiscrete = std::make_shared<DiscreteLookupTable>(
|
auto prunedDiscrete = std::make_shared<DiscreteLookupTable>(
|
||||||
frontals.size(), conditional->discreteKeys(), prunedDiscreteTree);
|
frontals.size(), conditional->discreteKeys(), prunedDiscreteFactor);
|
||||||
conditional = std::make_shared<HybridConditional>(prunedDiscrete);
|
conditional = std::make_shared<HybridConditional>(prunedDiscrete);
|
||||||
gttoc_(HybridBayesNet_MakeConditional);
|
gttoc_(HybridBayesNet_MakeConditional);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,8 @@ void HybridSmoother::update(HybridGaussianFactorGraph graph,
|
||||||
addConditionals(graph, hybridBayesNet_, ordering);
|
addConditionals(graph, hybridBayesNet_, ordering);
|
||||||
|
|
||||||
// Eliminate.
|
// Eliminate.
|
||||||
auto bayesNetFragment = graph.eliminateSequential(ordering);
|
HybridBayesNet::shared_ptr bayesNetFragment =
|
||||||
|
graph.eliminateSequential(ordering);
|
||||||
|
|
||||||
/// Prune
|
/// Prune
|
||||||
if (maxNrLeaves) {
|
if (maxNrLeaves) {
|
||||||
|
|
Loading…
Reference in New Issue