Moved template and inline functions to header file
parent
d9d2cb7dda
commit
d7a51c896b
|
|
@ -17,36 +17,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
#include <gtsam/inference/inference.h>
|
#include <gtsam/inference/inference.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
template<typename CONSTRAINED>
|
|
||||||
Permutation::shared_ptr Inference::PermutationCOLAMD(const VariableIndex& variableIndex, const CONSTRAINED& constrainLast) {
|
|
||||||
|
|
||||||
vector<int> cmember(variableIndex.size(), 0);
|
|
||||||
|
|
||||||
// If at least some variables are not constrained to be last, constrain the
|
|
||||||
// ones that should be constrained.
|
|
||||||
if(constrainLast.size() < variableIndex.size()) {
|
|
||||||
BOOST_FOREACH(Index var, constrainLast) {
|
|
||||||
assert(var < variableIndex.size());
|
|
||||||
cmember[var] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PermutationCOLAMD_(variableIndex, cmember);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
inline Permutation::shared_ptr Inference::PermutationCOLAMD(const VariableIndex& variableIndex) {
|
|
||||||
vector<int> cmember(variableIndex.size(), 0);
|
|
||||||
return PermutationCOLAMD_(variableIndex, cmember);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gtsam
|
} // namespace gtsam
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
#include <gtsam/inference/VariableIndex.h>
|
#include <gtsam/inference/VariableIndex.h>
|
||||||
#include <gtsam/inference/Permutation.h>
|
#include <gtsam/inference/Permutation.h>
|
||||||
|
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
|
|
@ -52,4 +54,28 @@ namespace gtsam {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
template<typename CONSTRAINED>
|
||||||
|
Permutation::shared_ptr Inference::PermutationCOLAMD(const VariableIndex& variableIndex, const CONSTRAINED& constrainLast) {
|
||||||
|
|
||||||
|
std::vector<int> cmember(variableIndex.size(), 0);
|
||||||
|
|
||||||
|
// If at least some variables are not constrained to be last, constrain the
|
||||||
|
// ones that should be constrained.
|
||||||
|
if(constrainLast.size() < variableIndex.size()) {
|
||||||
|
BOOST_FOREACH(Index var, constrainLast) {
|
||||||
|
assert(var < variableIndex.size());
|
||||||
|
cmember[var] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PermutationCOLAMD_(variableIndex, cmember);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
inline Permutation::shared_ptr Inference::PermutationCOLAMD(const VariableIndex& variableIndex) {
|
||||||
|
std::vector<int> cmember(variableIndex.size(), 0);
|
||||||
|
return PermutationCOLAMD_(variableIndex, cmember);
|
||||||
|
}
|
||||||
|
|
||||||
} /// namespace gtsam
|
} /// namespace gtsam
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue