00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00030 00031 #ifndef __GAUSSIAN_H 00032 #define __GAUSSIAN_H 00033 00034 #include "PDF.h" 00035 00036 using namespace MipBaselib; 00037 using namespace arma; 00038 00039 namespace MipBaselib{ 00040 00042 /* @{ */ 00043 00047 class Gaussian:public PDF{ 00048 protected: 00049 00050 DCol _mean; 00051 DMat _cov; 00052 DMat _covInv; 00053 bool _covInvComputed; 00054 00055 void _computeCovInv(); 00056 00057 public: 00058 00060 Gaussian(); 00061 00065 Gaussian(DCol m, DMat &c); 00066 00069 Gaussian(const Gaussian &g); 00070 00072 int dim(); 00073 00076 void operator=(const Gaussian &g); 00077 00079 DCol expectedValue(); 00080 00083 DCol expectedValue(const int n); 00084 00088 Decimal covariance(int row, int col); 00089 00091 DMat& covariance(); 00092 00094 DMat covariance(const int n) const; 00095 00098 Decimal evaluate(DCol p); 00099 00102 Gaussian marginalize(int n); 00103 00106 void printCovInv(); 00107 00110 virtual string print(); 00111 }; 00112 00113 /* @} */ 00114 } 00115 00116 00117 #endif 00118 00119 00120 00121 00122 00123 00124 00125