iSAM
Covariances.h
Go to the documentation of this file.
00001 
00028 #pragma once
00029 
00030 #include <list>
00031 #include <map>
00032 #include <Eigen/Dense>
00033 
00034 #include "SparseSystem.h"
00035 #include "Node.h"
00036 #include "covariance.h"
00037 
00038 namespace isam {
00039 
00040 class Slam;
00041 
00042 class Covariances {
00043 private:
00044   // either directly coupled to a Slam object...
00045   Slam* _slam;
00046 
00047   // ...or we operate on a copy of the relevant data from a Slam object
00048   SparseSystem _R;
00049   std::map<Node*, std::pair<int, int> > _index;
00050 
00051   mutable CovarianceCache _cache;
00052 
00053   // utility function for _index
00054   int get_start(Node* node) const;
00055   int get_dim(Node* node) const;
00056 
00057   // only used for cloning below
00058   Covariances(Slam& slam);
00059 
00060 public:
00061 
00066   Covariances(Slam* slam) : _slam(slam), _R(1,1) {}
00067 
00068   virtual ~Covariances() {};
00069 
00076   virtual Covariances clone() const {
00077     return Covariances(*_slam);
00078   }
00079 
00080   typedef std::list<std::list<Node*> > node_lists_t;
00081   typedef std::list<std::pair<Node*, Node*> > node_pair_list_t;
00082 
00091   virtual std::list<Eigen::MatrixXd> marginal(const node_lists_t& node_lists) const;
00092 
00098   virtual Eigen::MatrixXd marginal(const std::list<Node*>& nodes) const;
00099 
00110   virtual std::list<Eigen::MatrixXd> access(const node_pair_list_t& node_pair_list) const;
00111 
00112 };
00113 
00114 }
 All Classes Files Functions Variables