Inherited methods show up on doc. ISAM2 for MATLAB now inherets from Bayes Tree

release/4.3a0
Andrew Melim 2012-09-08 19:51:23 +00:00
parent d8a6b6a5e4
commit 4752c10e21
13 changed files with 108 additions and 41 deletions

34
gtsam.h
View File

@ -898,6 +898,24 @@ class VariableIndex {
void permuteInPlace(const gtsam::Permutation& permutation);
};
#include <gtsam/inference/BayesTree.h>
template<CONDITIONAL, CLIQUE>
virtual class BayesTree {
//Constructors
BayesTree();
//Standard Interface
//bool equals(const gtsam::BayesTree<CONDITIONAL, CLIQUE>& other, double tol) const;
void print(string s);
size_t size();
CLIQUE* root() const;
void clear();
void insert(const CLIQUE* subtree);
};
typedef gtsam::BayesTree<gtsam::GaussianConditional, gtsam::ISAM2Clique> ISAM2BayesTree;
//*************************************************************************
// linear
//*************************************************************************
@ -1672,6 +1690,20 @@ class ISAM2Params {
void setEnablePartialRelinearizationCheck(bool enablePartialRelinearizationCheck);
};
virtual class ISAM2Clique {
//Constructors
ISAM2Clique(const gtsam::GaussianConditional* conditional);
//Standard Interface
Vector gradientContribution() const;
gtsam::ISAM2Clique* clone() const;
void print(string s);
void permuteWithInverse(const gtsam::Permutation& inversePermutation);
bool permuteSeparatorWithInverse(const gtsam::Permutation& inversePermutation);
};
class ISAM2Result {
ISAM2Result();
@ -1683,7 +1715,7 @@ class ISAM2Result {
size_t getCliques() const;
};
class ISAM2 {
virtual class ISAM2 : gtsam::ISAM2BayesTree {
ISAM2();
ISAM2(const gtsam::ISAM2Params& params);

View File

@ -338,7 +338,7 @@ namespace gtsam {
template<class CONDITIONAL, class CLIQUE>
void BayesTree<CONDITIONAL,CLIQUE>::print(const std::string& s, const IndexFormatter& indexFormatter) const {
if (root_.use_count() == 0) {
printf("WARNING: BayesTree.print encountered a forest...\n");
std::cout << "WARNING: BayesTree.print encountered a forest..." << std::endl;
return;
}
std::cout << s << ": clique size == " << size() << ", node size == " << nodes_.size() << std::endl;

View File

@ -342,6 +342,15 @@ Module::Module(const string& interfacePath,
printf("parsing stopped at \n%.20s\n",info.stop);
throw ParseFailed((int)info.length);
}
//Explicitly add methods to the classes from parents so it shows in documentation
BOOST_FOREACH(Class& cls, classes)
{
map<string, Method> inhereted = appendInheretedMethods(cls, classes);
cls.methods.insert(inhereted.begin(), inhereted.end());
}
}
/* ************************************************************************* */
@ -432,6 +441,7 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co
// verify parents
if(!cls.qualifiedParent.empty() && std::find(validTypes.begin(), validTypes.end(), wrap::qualifiedName("::", cls.qualifiedParent)) == validTypes.end())
throw DependencyMissing(wrap::qualifiedName("::", cls.qualifiedParent), cls.qualifiedName("::"));
}
// Create type attributes table and check validity
@ -472,6 +482,33 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co
wrapperFile.emit(true);
}
/* ************************************************************************* */
map<string, Method> Module::appendInheretedMethods(const Class& cls, const vector<Class>& classes)
{
map<string, Method> methods;
if(!cls.qualifiedParent.empty())
{
cout << "Class: " << cls.name << " Parent Name: " << cls.qualifiedParent.back() << endl;
//Find Class
BOOST_FOREACH(const Class& parent, classes)
{
//We found the class for our parent
if(parent.name == cls.qualifiedParent.back())
{
cout << "Inner class: " << cls.qualifiedParent.back() << endl;
Methods inhereted = appendInheretedMethods(parent, classes);
methods.insert(inhereted.begin(), inhereted.end());
}
}
}
else
{
cout << "Dead end: " << cls.name << endl;
methods.insert(cls.methods.begin(), cls.methods.end());
}
return methods;
}
/* ************************************************************************* */
void Module::finish_wrapper(FileWriter& file, const std::vector<std::string>& functionNames) const {

View File

@ -35,6 +35,7 @@ namespace wrap {
struct Module {
typedef std::map<std::string, GlobalFunction> GlobalFunctions;
typedef std::map<std::string, Method> Methods;
std::string name; ///< module name
std::vector<Class> classes; ///< list of classes
@ -49,6 +50,9 @@ struct Module {
const std::string& moduleName,
bool enable_verbose=true);
//Recursive method to append all methods inhereted from parent classes
std::map<std::string, Method> appendInheretedMethods(const Class& cls, const std::vector<Class>& classes);
/// MATLAB code generation:
void matlab_code(
const std::string& path,

View File

@ -1,7 +1,10 @@
%class Point2, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%Point2()
%Point2(double x, double y)
%
%
%-------Methods-------
%argChar(char a) : returns void
%argUChar(unsigned char a) : returns void
@ -10,10 +13,7 @@
%vectorConfusion() : returns VectorNotEigen
%x() : returns double
%y() : returns double
%
%-------Static Methods-------
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef Point2 < handle
properties
ptr_Point2 = 0

View File

@ -1,14 +1,16 @@
%class Point3, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%Point3(double x, double y, double z)
%
%
%-------Methods-------
%norm() : returns double
%
%
%-------Static Methods-------
%StaticFunctionRet(double z) : returns Point3
%staticFunction() : returns double
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef Point3 < handle
properties
ptr_Point3 = 0

View File

@ -1,7 +1,10 @@
%class Test, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%Test()
%Test(double a, Matrix b)
%
%
%-------Methods-------
%arg_EigenConstRef(Matrix value) : returns void
%create_MixedPtrs() : returns pair< Test, SharedTest >
@ -22,10 +25,7 @@
%return_string(string value) : returns string
%return_vector1(Vector value) : returns Vector
%return_vector2(Vector value) : returns Vector
%
%-------Static Methods-------
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef Test < handle
properties
ptr_Test = 0

View File

@ -1,11 +1,9 @@
%class ClassA, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%ClassA()
%
%-------Methods-------
%
%-------Static Methods-------
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef ClassA < handle
properties
ptr_ns1ClassA = 0

View File

@ -1,11 +1,9 @@
%class ClassB, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%ClassB()
%
%-------Methods-------
%
%-------Static Methods-------
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef ClassB < handle
properties
ptr_ns1ClassB = 0

View File

@ -1,11 +1,9 @@
%class ClassB, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%ClassB()
%
%-------Methods-------
%
%-------Static Methods-------
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef ClassB < handle
properties
ptr_ns2ns3ClassB = 0

View File

@ -1,15 +1,17 @@
%class ClassA, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%ClassA()
%
%
%-------Methods-------
%memberFunction() : returns double
%nsArg(ClassB arg) : returns int
%nsReturn(double q) : returns ns2::ns3::ClassB
%
%
%-------Static Methods-------
%afunction() : returns double
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef ClassA < handle
properties
ptr_ns2ClassA = 0

View File

@ -1,11 +1,9 @@
%class ClassC, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%ClassC()
%
%-------Methods-------
%
%-------Static Methods-------
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef ClassC < handle
properties
ptr_ns2ClassC = 0

View File

@ -1,11 +1,9 @@
%class ClassD, see Doxygen page for details
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
%
%-------Constructors-------
%ClassD()
%
%-------Methods-------
%
%-------Static Methods-------
%
%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
classdef ClassD < handle
properties
ptr_ClassD = 0