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 {
/* ************************************************************************* */
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 {
// Solve for mean

View File

@ -34,16 +34,14 @@ namespace gtsam {
public:
protected:
public:
typedef boost::shared_ptr<GaussianDensity> shared_ptr;
/// default constructor needed for serialization
GaussianDensity() :
GaussianConditional() {
}
// Copy constructor from GaussianConditional
/// Copy constructor from GaussianConditional
GaussianDensity(const GaussianConditional& conditional) :
GaussianConditional(conditional) {
assert(conditional.nrParents() == 0);
@ -55,7 +53,10 @@ namespace gtsam {
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;
/// Information matrix \f$ \Lambda = R^T R \f$