From 022f706d94f970c4820d46145d0fcd35043919eb Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Wed, 24 Feb 2010 14:19:52 +0000 Subject: [PATCH] Changed default elimination algorithm to newer one with fewer matrix allocations to solve crashing bug from LM discovered in MAST --- cpp/GaussianFactorGraph.h | 6 +++--- cpp/testGaussianFactor.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cpp/GaussianFactorGraph.h b/cpp/GaussianFactorGraph.h index 389066ead..981591569 100644 --- a/cpp/GaussianFactorGraph.h +++ b/cpp/GaussianFactorGraph.h @@ -123,7 +123,7 @@ namespace gtsam { * @param enableJoinFactor uses the older joint factor combine process when true, * and when false uses the newer single matrix combine */ - GaussianConditional::shared_ptr eliminateOne(const Symbol& key, bool enableJoinFactor = true); + GaussianConditional::shared_ptr eliminateOne(const Symbol& key, bool enableJoinFactor = false); /** * Peforms a supposedly-faster (fewer matrix copy) version of elimination @@ -138,7 +138,7 @@ namespace gtsam { * @param enableJoinFactor uses the older joint factor combine process when true, * and when false uses the newer single matrix combine */ - GaussianBayesNet eliminate(const Ordering& ordering, bool enableJoinFactor = true); + GaussianBayesNet eliminate(const Ordering& ordering, bool enableJoinFactor = false); /** * optimize a linear factor graph @@ -146,7 +146,7 @@ namespace gtsam { * @param enableJoinFactor uses the older joint factor combine process when true, * and when false uses the newer single matrix combine */ - VectorConfig optimize(const Ordering& ordering, bool enableJoinFactor = true); + VectorConfig optimize(const Ordering& ordering, bool enableJoinFactor = false); /** * shared pointer versions for MATLAB diff --git a/cpp/testGaussianFactor.cpp b/cpp/testGaussianFactor.cpp index 8da652181..e88779de5 100644 --- a/cpp/testGaussianFactor.cpp +++ b/cpp/testGaussianFactor.cpp @@ -762,11 +762,11 @@ TEST ( GaussianFactor, combine_matrix ) { } /* ************************************************************************* */ -// FIXME: Executing this test results in a memory corruption error that -// crashes out and prints a stack trace on Ubuntu. TEST ( GaussianFactor, exploding_MAST_factor ) { + // Test derived from a crashing error in MAST + // Works properly with the newer elimination code + // This is only a test of execution without crashing - // Tried switching to a different number, still same problem Symbol lA2('l', 18295873486192642); Matrix A1 = eye(2); Vector b1 = zero(2); @@ -785,8 +785,9 @@ TEST ( GaussianFactor, exploding_MAST_factor ) { fg.push_back(f1); fg.push_back(f2); - // FIXME: Uncomment to cause the error - //GaussianConditional::shared_ptr cg = fg.eliminateOne(lA2); + // works when using the newer implementation of eliminate + GaussianConditional::shared_ptr cg = fg.eliminateOne(lA2); + CHECK(true); }