add push_back to HybridBayesNet

release/4.3a0
Varun Agrawal 2022-09-16 18:13:59 -04:00
parent 93528c3d4f
commit aebcde99e2
2 changed files with 17 additions and 0 deletions

View File

@ -73,6 +73,8 @@ class GTSAM_EXPORT HybridBayesNet : public BayesNet<HybridConditional> {
HybridConditional(boost::make_shared<DiscreteConditional>(key, table)));
}
using Base::push_back;
/// Get a specific Gaussian mixture by index `i`.
GaussianMixture::shared_ptr atMixture(size_t i) const;

View File

@ -52,6 +52,21 @@ TEST(HybridBayesNet, Creation) {
EXPECT(df.equals(expected));
}
/* ****************************************************************************/
// Test adding a bayes net to another one.
TEST(HybridBayesNet, Add) {
HybridBayesNet bayesNet;
bayesNet.add(Asia, "99/1");
DiscreteConditional expected(Asia, "99/1");
HybridBayesNet other;
other.push_back(bayesNet);
EXPECT(bayesNet.equals(other));
}
/* ****************************************************************************/
// Test choosing an assignment of conditionals
TEST(HybridBayesNet, Choose) {