shared_ptr typedef and print method

release/4.3a0
Frank Dellaert 2012-01-27 22:19:05 +00:00
parent ac5d539afb
commit 53e6c6047f
2 changed files with 19 additions and 5 deletions

View File

@ -22,6 +22,19 @@ using namespace std;
namespace gtsam { namespace gtsam {
/* ************************************************************************* */
void GaussianDensity::print(const string &s) const
{
cout << s << ": density on ";
for(const_iterator it = beginFrontals(); it != endFrontals(); ++it)
cout << (boost::format("[%1%]")%(*it)).str() << " ";
cout << endl;
gtsam::print(Matrix(get_R()),"R");
gtsam::print(Vector(get_d()),"d");
gtsam::print(sigmas_,"sigmas");
cout << "Permutation: " << permutation_.indices().transpose() << endl;
}
/* ************************************************************************* */ /* ************************************************************************* */
Vector GaussianDensity::mean() const { Vector GaussianDensity::mean() const {
// Solve for mean // Solve for mean

View File

@ -34,16 +34,14 @@ namespace gtsam {
public: public:
protected: typedef boost::shared_ptr<GaussianDensity> shared_ptr;
public:
/// default constructor needed for serialization /// default constructor needed for serialization
GaussianDensity() : GaussianDensity() :
GaussianConditional() { GaussianConditional() {
} }
// Copy constructor from GaussianConditional /// Copy constructor from GaussianConditional
GaussianDensity(const GaussianConditional& conditional) : GaussianDensity(const GaussianConditional& conditional) :
GaussianConditional(conditional) { GaussianConditional(conditional) {
assert(conditional.nrParents() == 0); assert(conditional.nrParents() == 0);
@ -55,7 +53,10 @@ namespace gtsam {
GaussianConditional(key, d, R, sigmas) { GaussianConditional(key, d, R, sigmas) {
} }
// Mean \f$ \mu = R^{-1} d \f$ /// print
void print(const std::string& = "GaussianDensity") const;
/// Mean \f$ \mu = R^{-1} d \f$
Vector mean() const; Vector mean() const;
/// Information matrix \f$ \Lambda = R^T R \f$ /// Information matrix \f$ \Lambda = R^T R \f$