fixed unit test, clean up ccolamd code

release/4.3a0
Michael Kaess 2010-07-09 18:15:54 +00:00
parent d1280495e3
commit 80dc9510d6
3 changed files with 4 additions and 7 deletions

View File

@ -6,6 +6,7 @@
* @author Carlos Nieto * @author Carlos Nieto
* @author Frank Dellaert * @author Frank Dellaert
* @author Alireza Fathi * @author Alireza Fathi
* @author Michael Kaess
*/ */
#pragma once #pragma once
@ -189,7 +190,6 @@ void colamd(int n_col, int n_row, int nrNonZeros, const map<Key, vector<int> >&
// Convert to compressed column major format colamd wants it in (== MATLAB format!) // Convert to compressed column major format colamd wants it in (== MATLAB format!)
vector<Key> initialOrder; vector<Key> initialOrder;
// int Alen = nrNonZeros*30; /* colamd arg 3: size of the array A TODO: use Tim's function ! */
int Alen = ccolamd_recommended(nrNonZeros, n_row, n_col); /* colamd arg 3: size of the array A */ int Alen = ccolamd_recommended(nrNonZeros, n_row, n_col); /* colamd arg 3: size of the array A */
int * A = new int[Alen]; /* colamd arg 4: row indices of A, of size Alen */ int * A = new int[Alen]; /* colamd arg 4: row indices of A, of size Alen */
int * p = new int[n_col + 1]; /* colamd arg 5: column pointers of A, of size n_col+1 */ int * p = new int[n_col + 1]; /* colamd arg 5: column pointers of A, of size n_col+1 */
@ -224,11 +224,7 @@ void colamd(int n_col, int n_row, int nrNonZeros, const map<Key, vector<int> >&
// call colamd, result will be in p ************************************************* // call colamd, result will be in p *************************************************
/* TODO: returns (1) if successful, (0) otherwise*/ /* TODO: returns (1) if successful, (0) otherwise*/
#if 0
::colamd(n_row, n_col, Alen, A, p, knobs, stats);
#else
::ccolamd(n_row, n_col, Alen, A, p, knobs, stats, cmember); ::ccolamd(n_row, n_col, Alen, A, p, knobs, stats, cmember);
#endif
// ********************************************************************************** // **********************************************************************************
delete [] A; // delete symbolic A delete [] A; // delete symbolic A
delete [] cmember; delete [] cmember;

View File

@ -3,6 +3,7 @@
* @brief Factor Graph Base Class * @brief Factor Graph Base Class
* @author Carlos Nieto * @author Carlos Nieto
* @author Christian Potthast * @author Christian Potthast
* @author Michael Kaess
*/ */
// \callgraph // \callgraph
@ -104,7 +105,7 @@ namespace gtsam {
std::pair<FactorGraph<Factor>, std::set<Symbol> > removeSingletons(); std::pair<FactorGraph<Factor>, std::set<Symbol> > removeSingletons();
/** /**
* Compute colamd ordering, including I/O and shared pointer version * Compute colamd ordering, including I/O, constrained ordering, and shared pointer version
*/ */
void getOrdering(Ordering& ordering, const std::set<Symbol>& lastKeys, boost::optional<const std::set<Symbol>&> interested = boost::none) const; void getOrdering(Ordering& ordering, const std::set<Symbol>& lastKeys, boost::optional<const std::set<Symbol>&> interested = boost::none) const;
Ordering getOrdering() const; Ordering getOrdering() const;

View File

@ -441,7 +441,7 @@ TEST( GaussianFactorGraph, CONSTRUCTOR_GaussianBayesNet )
TEST( GaussianFactorGraph, getOrdering) TEST( GaussianFactorGraph, getOrdering)
{ {
Ordering expected; Ordering expected;
expected += "l1","x1","x2"; expected += "l1","x2","x1";
GaussianFactorGraph fg = createGaussianFactorGraph(); GaussianFactorGraph fg = createGaussianFactorGraph();
Ordering actual = fg.getOrdering(); Ordering actual = fg.getOrdering();
CHECK(assert_equal(expected,actual)); CHECK(assert_equal(expected,actual));