From 422169873ca447951b1e2923b51946f9881dd28c Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Tue, 27 Oct 2009 13:33:44 +0000 Subject: [PATCH] moved [symbol] function to LinearFactor --- cpp/LinearFactor.cpp | 12 +++++++++++- cpp/LinearFactor.h | 8 ++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cpp/LinearFactor.cpp b/cpp/LinearFactor.cpp index e81eb2501..f1fbd4d64 100644 --- a/cpp/LinearFactor.cpp +++ b/cpp/LinearFactor.cpp @@ -237,7 +237,7 @@ LinearFactor::eliminate(const string& key) FOREACH_PAIR(j,A,As) { if (j != key) { const size_t nj = A.size2(); // get dimension of variable - cg->add(j, sub(A,0,n,0,nj)); // add a parent to conditional gaussian + cg->add(j, sub(A,0,n,0,nj)); // add a parent to conditional Gaussian lf->insert(j,sub(A,n,m,0,nj)); // insert into linear factor } } @@ -245,3 +245,13 @@ LinearFactor::eliminate(const string& key) } /* ************************************************************************* */ +namespace gtsam { + + string symbol(char c, int index) { + stringstream ss; + ss << c << index; + return ss.str(); + } + +} +/* ************************************************************************* */ diff --git a/cpp/LinearFactor.h b/cpp/LinearFactor.h index 7aa96a202..814dbeab6 100644 --- a/cpp/LinearFactor.h +++ b/cpp/LinearFactor.h @@ -228,4 +228,12 @@ public: /* ************************************************************************* */ +/** + * creates a C++ string a la "x3", "m768" + * @param c the base character + * @param index the integer to be added + * @return a C++ string + */ +std::string symbol(char c, int index); + } // namespace gtsam