Added notes concerning the ordering issue when handling sets of LinearFactor::shared_ptrs

release/4.3a0
Alex Cunningham 2009-10-14 21:06:44 +00:00
parent 7d0a30c20f
commit 485f8d003b
4 changed files with 21 additions and 6 deletions

View File

@ -187,6 +187,9 @@ public:
/** /**
* Constructor that combines a set of factors * Constructor that combines a set of factors
* NOTE: the combined factor will be depends on a system-dependent
* ordering of the input set of factors. Do not rely on this order
* when using the function.
* @param factors Set of factors to combine * @param factors Set of factors to combine
*/ */
CONSTRUCTOR CONSTRUCTOR

View File

@ -57,12 +57,17 @@ namespace gtsam {
/** /**
* find all the factors that involve the given node and remove them * find all the factors that involve the given node and remove them
* from the factor graph * from the factor graph
* NOTE: the ordering of the LinearFactor::shared_ptrs will change
* between systems, so do not rely on this ordering
* @param key the key for the given node * @param key the key for the given node
*/ */
LinearFactorSet find_factors_and_remove(const std::string& key); LinearFactorSet find_factors_and_remove(const std::string& key);
/** /**
* extract and combine all the factors that involve a given node * extract and combine all the factors that involve a given node
* NOTE: the combined factor will be depends on a system-dependent
* ordering of the input set of factors. Do not rely on this order
* when using the function.
* @param key the key for the given node * @param key the key for the given node
* @return the combined linear factor * @return the combined linear factor
*/ */

View File

@ -65,10 +65,9 @@ TEST( LinearFactor, variables )
/* ************************************************************************* */ /* ************************************************************************* */
// NOTE: This test does not pass when running on Linux (Ubuntu 9.04, GCC 4.3.3) // NOTE: This test fails due to order dependency in the extraction of factors
// systems, and appears to be dependent on the ordering of factors in the // To fix it, it will be necessary to construct the expected version
// set lfg. Reversing the order in which the matrices are appended will // of the combined factor taking into account the ordering in the set
// make this test work correctly, while the next test will fail.
TEST( LinearFactor, linearFactor2 ) TEST( LinearFactor, linearFactor2 )
{ {
// create a small linear factor graph // create a small linear factor graph

View File

@ -153,8 +153,10 @@ TEST( LinearFactorGraph, find_separator )
} }
/* ************************************************************************* */ /* ************************************************************************* */
// Note: This test does not pass when running on Linux(Ubuntu 9.04, GCC 4.3.3) // Note: This test fails on different systems due to a dependency on the ordering
// systems. // of LinearFactor::shared_ptr in STL sets. Because the ordering is based
// on pointer values instead of factor values, the ordering is different
// between separate systems.
TEST( LinearFactorGraph, combine_factors_x1 ) TEST( LinearFactorGraph, combine_factors_x1 )
{ {
// create a small example for a linear factor graph // create a small example for a linear factor graph
@ -163,6 +165,9 @@ TEST( LinearFactorGraph, combine_factors_x1 )
// combine all factors // combine all factors
LinearFactor::shared_ptr actual = fg.combine_factors("x1"); LinearFactor::shared_ptr actual = fg.combine_factors("x1");
//FIXME: this expected value must be constructed in the order that
// the factors are stored in a set - which differs between systems
// the expected linear factor // the expected linear factor
Matrix Al1 = Matrix_(6,2, Matrix Al1 = Matrix_(6,2,
0., 0., 0., 0.,
@ -215,6 +220,9 @@ TEST( LinearFactorGraph, combine_factors_x2 )
// combine all factors // combine all factors
LinearFactor::shared_ptr actual = fg.combine_factors("x2"); LinearFactor::shared_ptr actual = fg.combine_factors("x2");
// FIXME: change the ordering of the expected to match whatever the real
// ordering is and constructed the expected with the correct order
// the expected linear factor // the expected linear factor
Matrix Al1 = Matrix_(4,2, Matrix Al1 = Matrix_(4,2,
// l1 // l1