diff --git a/cpp/GaussianBayesNet.cpp b/cpp/GaussianBayesNet.cpp index fcdd3691d..d745ae8a7 100644 --- a/cpp/GaussianBayesNet.cpp +++ b/cpp/GaussianBayesNet.cpp @@ -156,17 +156,20 @@ pair matrix(const GaussianBayesNet& bn) { // find corresponding conditional GaussianConditional::shared_ptr cg = bn[key]; + // get sigmas + Vector sigmas = cg->get_sigmas(); + // get RHS and copy to d const Vector& d_ = cg->get_d(); const size_t n = d_.size(); for (size_t i=0;iget_R(); for (size_t i=0;iparentsBegin(); @@ -176,7 +179,7 @@ pair matrix(const GaussianBayesNet& bn) { const size_t J = mapping[keyS->first]; // find column index for (size_t i=0;iget_sigmas()(0),1e-5); + + // Check matrix + Matrix R;Vector d; + boost::tie(R,d) = matrix(bayesNet); + Matrix expected = Matrix_(2,2, + 0.707107, -0.353553, + 0.0, 0.612372); + CHECK(assert_equal(expected,R,1e-6)); +} + + /* ************************************************************************* */ // Tests ported from ConstrainedGaussianFactorGraph /* ************************************************************************* */ TEST( GaussianFactorGraph, constrained_simple )