00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _edoNormalMulti_h
00029 #define _edoNormalMulti_h
00030
00031 #include "edoDistrib.h"
00032
00033 #ifdef WITH_BOOST
00034 #include <boost/numeric/ublas/symmetric.hpp>
00035 #include <boost/numeric/ublas/lu.hpp>
00036 namespace ublas = boost::numeric::ublas;
00037 #else
00038 #ifdef WITH_EIGEN
00039 #include <Eigen/Dense>
00040 #endif // WITH_EIGEN
00041 #endif // WITH_BOOST
00042
00071 template < typename EOT >
00072 class edoNormalMulti : public edoDistrib< EOT >
00073 {
00074 #ifdef WITH_BOOST
00075
00076
00077 public:
00078 typedef typename EOT::AtomType AtomType;
00079
00080 edoNormalMulti( unsigned int dim = 1 ) :
00081 _mean( const ublas::vector<AtomType>(0,dim) ),
00082 _varcovar( const ublas::identity_matrix<AtomType>(dim) )
00083 {
00084 assert(_mean.size() > 0);
00085 assert(_mean.size() == _varcovar.size1());
00086 assert(_mean.size() == _varcovar.size2());
00087 }
00088
00089 edoNormalMulti
00090 (
00091 const ublas::vector< AtomType >& mean,
00092 const ublas::symmetric_matrix< AtomType, ublas::lower >& varcovar
00093 )
00094 : _mean(mean), _varcovar(varcovar)
00095 {
00096 assert(_mean.size() > 0);
00097 assert(_mean.size() == _varcovar.size1());
00098 assert(_mean.size() == _varcovar.size2());
00099 }
00100
00101 unsigned int size()
00102 {
00103 assert(_mean.size() == _varcovar.size1());
00104 assert(_mean.size() == _varcovar.size2());
00105 return _mean.size();
00106 }
00107
00108 ublas::vector< AtomType > mean() const {return _mean;}
00109 ublas::symmetric_matrix< AtomType, ublas::lower > varcovar() const {return _varcovar;}
00110
00111 private:
00112 ublas::vector< AtomType > _mean;
00113 ublas::symmetric_matrix< AtomType, ublas::lower > _varcovar;
00114
00115 #else
00116 #ifdef WITH_EIGEN
00117
00118
00119 public:
00120 typedef typename EOT::AtomType AtomType;
00121 typedef Eigen::Matrix< AtomType, Eigen::Dynamic, 1> Vector;
00122 typedef Eigen::Matrix< AtomType, Eigen::Dynamic, Eigen::Dynamic> Matrix;
00123
00124 edoNormalMulti( unsigned int dim = 1 ) :
00125 _mean( Vector::Zero(dim) ),
00126 _varcovar( Matrix::Identity(dim,dim) )
00127 {
00128 assert(_mean.size() > 0);
00129 assert(_mean.innerSize() == _varcovar.innerSize());
00130 assert(_mean.innerSize() == _varcovar.outerSize());
00131 }
00132
00133 edoNormalMulti(
00134 const Vector & mean,
00135 const Matrix & varcovar
00136 )
00137 : _mean(mean), _varcovar(varcovar)
00138 {
00139 assert(_mean.innerSize() > 0);
00140 assert(_mean.innerSize() == _varcovar.innerSize());
00141 assert(_mean.innerSize() == _varcovar.outerSize());
00142 }
00143
00144 unsigned int size()
00145 {
00146 assert(_mean.innerSize() == _varcovar.innerSize());
00147 assert(_mean.innerSize() == _varcovar.outerSize());
00148 return _mean.innerSize();
00149 }
00150
00151 Vector mean() const {return _mean;}
00152 Matrix varcovar() const {return _varcovar;}
00153
00154 private:
00155 Vector _mean;
00156 Matrix _varcovar;
00157
00158 #endif // WITH_EIGEN
00159 #endif // WITH_BOOST
00160
00161 };
00162
00163 #endif // !_edoNormalMulti_h