covariance.h
Go to the documentation of this file.
00001 
00029 #pragma once
00030 
00031 #include <vector>
00032 #include <utility> // pair
00033 #include <list>
00034 #include <Eigen/Dense>
00035 
00036 #define USE_TR1
00037 #ifdef USE_TR1
00038 #include <tr1/unordered_map>
00039 #else
00040 #include "boost/unordered_map.hpp"
00041 #endif
00042 
00043 #include "SparseMatrix.h"
00044 
00045 namespace isam {
00046 
00047 #ifdef USE_TR1
00048 #include <tr1/unordered_map>
00049 typedef std::tr1::unordered_map<int, double> umap;
00050 #else
00051 typedef boost::unordered_map<int, double> umap;
00052 #endif
00053 
00054 class CovarianceCache {
00055 public:
00056   umap entries;
00057   // precalculated diagonal inverses
00058   std::vector<double> diag;
00059   // recovering rows is expensive, buffer results
00060   std::vector<SparseVector> rows;
00061   // avoid having to cleanup buffers each time by explicitly marking entries as valid
00062   std::vector<unsigned int> rows_valid;
00063   // avoid having to cleanup valid entries by using different indices each time
00064   unsigned int current_valid;
00065   // stats
00066   int num_calc;
00067 
00068   CovarianceCache () {
00069     current_valid = 1;
00070   }
00071 };
00072 
00073 typedef std::vector< std::vector<int> > index_lists_t;
00074 typedef std::vector< std::pair<int, int> > entry_list_t;
00075 
00085 std::list<Eigen::MatrixXd> cov_marginal(const SparseMatrix& R, CovarianceCache& cache,
00086                                         const index_lists_t& index_lists,
00087                                         bool debug=false, int step=-1);
00088 
00099 std::list<double> cov_marginal(const SparseMatrix& R, CovarianceCache& cache,
00100                                const entry_list_t& entry_list);
00101 
00102 }


demo_lidar
Author(s): Ji Zhang
autogenerated on Fri Jan 3 2014 11:17:39