32 std::cout << (s.empty() ?
"" : s +
" ") << std::endl;
33 std::cout <<
"size: " <<
size() << std::endl;
36 ss <<
"factor " <<
i <<
": ";
38 factors_[
i]->print(ss.str(), keyFormatter);
39 std::cout << std::endl;
46 const Values& continuousValues)
const {
47 using std::dynamic_pointer_cast;
50 auto linearFG = std::make_shared<HybridGaussianFactorGraph>();
52 linearFG->reserve(
size());
63 if (
auto mf = dynamic_pointer_cast<MixtureFactor>(
f)) {
65 mf->linearize(continuousValues);
66 linearFG->push_back(gmf);
67 }
else if (
auto nlf = dynamic_pointer_cast<NonlinearFactor>(
f)) {
69 linearFG->push_back(gf);
70 }
else if (dynamic_pointer_cast<DecisionTreeFactor>(
f)) {
72 linearFG->push_back(
f);
73 }
else if (
auto gmf = dynamic_pointer_cast<GaussianMixtureFactor>(
f)) {
74 linearFG->push_back(gmf);
75 }
else if (
auto gm = dynamic_pointer_cast<GaussianMixture>(
f)) {
76 linearFG->push_back(gm);
77 }
else if (dynamic_pointer_cast<GaussianFactor>(
f)) {
78 linearFG->push_back(
f);
81 throw std::invalid_argument(
82 std::string(
"HybridNonlinearFactorGraph::linearize: factor type " void print(const std::string &s="HybridNonlinearFactorGraph", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Print the factor graph.
A hybrid conditional in the Conditional Linear Gaussian scheme.
Nonlinear hybrid factor graph that uses type erasure.
Nonlinear Mixture factor of continuous and discrete.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
std::shared_ptr< This > shared_ptr
shared_ptr to This
std::shared_ptr< This > shared_ptr
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Linearized Hybrid factor graph that uses type erasure.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
static std::stringstream ss
std::string demangle(const char *name)
Pretty print Value type name.
Non-linear factor base classes.
std::shared_ptr< HybridGaussianFactorGraph > linearize(const Values &continuousValues) const
Linearize all the continuous factors in the HybridNonlinearFactorGraph.
FastVector< sharedFactor > factors_