changed template argument names

release/4.3a0
Frank Dellaert 2010-03-12 22:00:55 +00:00
parent 10af1930bb
commit 503fe46306
2 changed files with 26 additions and 26 deletions

View File

@ -20,22 +20,22 @@ using namespace std;
namespace gtsam {
/* ************************************************************************* */
template<class G, class T>
SubgraphSolver<G, T>::SubgraphSolver(const G& g, const T& theta0) {
initialize(g,theta0);
template<class Graph, class Config>
SubgraphSolver<Graph, Config>::SubgraphSolver(const Graph& G, const Config& theta0) {
initialize(G,theta0);
}
/* ************************************************************************* */
template<class G, class T>
void SubgraphSolver<G, T>::initialize(const G& g, const T& theta0) {
template<class Graph, class Config>
void SubgraphSolver<Graph, Config>::initialize(const Graph& G, const Config& theta0) {
// generate spanning tree
PredecessorMap<Key> tree = g.template findMinimumSpanningTree<Key, Constraint>();
PredecessorMap<Key> tree = G.template findMinimumSpanningTree<Key, Constraint>();
list<Key> keys = predecessorMap2Keys(tree);
// split the graph
if (verbose_) cout << "generating spanning tree and split the graph ...";
g.template split<Key, Constraint>(tree, T_, C_);
G.template split<Key, Constraint>(tree, T_, C_);
if (verbose_) cout << T_.size() << " and " << C_.size() << " factors" << endl;
// make the ordering
@ -46,12 +46,12 @@ namespace gtsam {
// compose the approximate solution
Key root = keys.back();
theta_bar_ = composePoses<G, Constraint, Pose, T> (T_, tree, theta0[root]);
theta_bar_ = composePoses<Graph, Constraint, Pose, Config> (T_, tree, theta0[root]);
}
/* ************************************************************************* */
template<class G, class T>
boost::shared_ptr<SubgraphPreconditioner> SubgraphSolver<G, T>::linearize(const G& g, const T& theta_bar) const {
template<class Graph, class Config>
boost::shared_ptr<SubgraphPreconditioner> SubgraphSolver<Graph, Config>::linearize(const Graph& G, const Config& theta_bar) const {
SubgraphPreconditioner::sharedFG Ab1 = T_.linearize(theta_bar);
SubgraphPreconditioner::sharedFG Ab2 = C_.linearize(theta_bar);
#ifdef TIMING
@ -68,8 +68,8 @@ namespace gtsam {
}
/* ************************************************************************* */
template<class G, class T>
VectorConfig SubgraphSolver<G, T>::optimize(SubgraphPreconditioner& system) const {
template<class Graph, class Config>
VectorConfig SubgraphSolver<Graph, Config>::optimize(SubgraphPreconditioner& system) const {
VectorConfig zeros = system.zero();
// Solve the subgraph PCG

View File

@ -19,13 +19,13 @@ namespace gtsam {
* linearize: G * T -> L
* solve : L -> VectorConfig
*/
template<class G, class T>
template<class Graph, class Config>
class SubgraphSolver {
private:
typedef typename T::Key Key;
typedef typename G::Constraint Constraint;
typedef typename G::Pose Pose;
typedef typename Config::Key Key;
typedef typename Graph::Constraint Constraint;
typedef typename Graph::Pose Pose;
// TODO not hardcode
static const size_t maxIterations_=100;
@ -36,25 +36,25 @@ namespace gtsam {
boost::shared_ptr<Ordering> ordering_;
/* the solution computed from the first subgraph */
boost::shared_ptr<T> theta_bar_;
boost::shared_ptr<Config> theta_bar_;
G T_, C_;
Graph T_, C_;
public:
SubgraphSolver() {}
SubgraphSolver(const G& g, const T& theta0);
SubgraphSolver(const Graph& G, const Config& theta0);
void initialize(const G& g, const T& theta0);
void initialize(const Graph& G, const Config& theta0);
boost::shared_ptr<Ordering> ordering() const { return ordering_; }
boost::shared_ptr<T> theta_bar() const { return theta_bar_; }
boost::shared_ptr<Config> theta_bar() const { return theta_bar_; }
/**
* linearize the non-linear graph around the current config and build the subgraph preconditioner systme
*/
boost::shared_ptr<SubgraphPreconditioner> linearize(const G& g, const T& theta_bar) const;
boost::shared_ptr<SubgraphPreconditioner> linearize(const Graph& G, const Config& theta_bar) const;
/**
* solve for the optimal displacement in the tangent space, and then solve
@ -63,9 +63,9 @@ namespace gtsam {
VectorConfig optimize(SubgraphPreconditioner& system) const;
};
template<class G, class T> const size_t SubgraphSolver<G,T>::maxIterations_;
template<class G, class T> const bool SubgraphSolver<G,T>::verbose_;
template<class G, class T> const double SubgraphSolver<G,T>::epsilon_;
template<class G, class T> const double SubgraphSolver<G,T>::epsilon_abs_;
template<class Graph, class Config> const size_t SubgraphSolver<Graph,Config>::maxIterations_;
template<class Graph, class Config> const bool SubgraphSolver<Graph,Config>::verbose_;
template<class Graph, class Config> const double SubgraphSolver<Graph,Config>::epsilon_;
template<class Graph, class Config> const double SubgraphSolver<Graph,Config>::epsilon_abs_;
} // nsamespace gtsam