DiscreteMarginals.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
21 #pragma once
22 
25 #include <gtsam/base/Vector.h>
26 
27 namespace gtsam {
28 
34 
35  protected:
36 
38 
39  public:
40 
42 
47  bayesTree_ = graph.eliminateMultifrontal();
48  }
49 
52  // Compute marginal
53  DiscreteFactor::shared_ptr marginalFactor;
54  marginalFactor = bayesTree_->marginalFactor(variable, &EliminateDiscrete);
55  return marginalFactor;
56  }
57 
63  // Compute marginal
64  DiscreteFactor::shared_ptr marginalFactor;
65  marginalFactor = bayesTree_->marginalFactor(key.first, &EliminateDiscrete);
66 
67  //Create result
68  Vector vResult(key.second);
69  for (size_t state = 0; state < key.second ; ++ state) {
71  values[key.first] = state;
72  vResult(state) = (*marginalFactor)(values);
73  }
74  return vResult;
75  }
76 
77  };
78 
79 } /* namespace gtsam */
gtsam::DiscreteMarginals::operator()
DiscreteFactor::shared_ptr operator()(Key variable) const
Definition: DiscreteMarginals.h:51
gtsam::DiscreteFactorGraph
Definition: DiscreteFactorGraph.h:98
Vector.h
typedef and functions to augment Eigen's VectorXd
gtsam::DiscreteMarginals::DiscreteMarginals
DiscreteMarginals(const DiscreteFactorGraph &graph)
Definition: DiscreteMarginals.h:46
gtsam::DiscreteBayesTree::shared_ptr
std::shared_ptr< This > shared_ptr
Definition: DiscreteBayesTree.h:80
DiscreteFactorGraph.h
gtsam::DiscreteMarginals::DiscreteMarginals
DiscreteMarginals()
Definition: DiscreteMarginals.h:41
different_sigmas::values
HybridValues values
Definition: testHybridBayesNet.cpp:245
gtsam::DiscreteMarginals::bayesTree_
DiscreteBayesTree::shared_ptr bayesTree_
Definition: DiscreteMarginals.h:37
gtsam::Vector
Eigen::VectorXd Vector
Definition: Vector.h:38
gtsam::EliminateDiscrete
std::pair< DiscreteConditional::shared_ptr, DecisionTreeFactor::shared_ptr > EliminateDiscrete(const DiscreteFactorGraph &factors, const Ordering &frontalKeys)
Main elimination function for DiscreteFactorGraph.
Definition: DiscreteFactorGraph.cpp:205
gtsam::DiscreteMarginals
Definition: DiscreteMarginals.h:33
DiscreteBayesTree.h
Discrete Bayes Tree, the result of eliminating a DiscreteJunctionTree.
key
const gtsam::Symbol key('X', 0)
gtsam
traits
Definition: SFMdata.h:40
gtsam::DiscreteFactor::shared_ptr
std::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
Definition: DiscreteFactor.h:44
gtsam::DiscreteValues
Definition: DiscreteValues.h:34
gtsam::DiscreteKey
std::pair< Key, size_t > DiscreteKey
Definition: DiscreteKey.h:38
graph
NonlinearFactorGraph graph
Definition: doc/Code/OdometryExample.cpp:2
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
gtsam::DiscreteMarginals::marginalProbabilities
Vector marginalProbabilities(const DiscreteKey &key) const
Definition: DiscreteMarginals.h:62
make_changelog.state
state
Definition: make_changelog.py:29


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:13