00001 /*************************************************************************** 00002 ** 00003 ** This file is part of DinverCore. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created : 2007-04-11 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef PDFCURVE_H 00028 #define PDFCURVE_H 00029 00030 #include <QGpCoreTools.h> 00031 #include "UniqueRandom.h" 00032 #include "ModelSet.h" 00033 #include "DinverCoreDLLExport.h" 00034 00035 namespace DinverCore { 00036 00037 class Parameter; 00038 00039 class DINVERCORE_EXPORT PdfPoint 00040 { 00041 public: 00042 PdfPoint() {_x=0.0; _cell=-1;} 00043 PdfPoint(double x, int cell) {_x=x; _cell=cell;} 00044 00045 double x() const {return _x;} 00046 int cell() const {return _cell;} 00047 inline double probability(const ModelSet& models) const; 00048 00049 static void setDegreesOfFreedom(double dof) {_degreesOfFreedom=dof;} 00050 private: 00051 double _x; 00052 int _cell; 00053 static double _degreesOfFreedom; 00054 }; 00055 00056 class DINVERCORE_EXPORT PdfCurve : public Curve<PdfPoint> 00057 { 00058 public: 00059 double randomValue(UniqueRandom& generator, const ModelSet& models, int& cellIndex); 00060 void toStream(QTextStream& s, const ModelSet& models); 00061 void printCumulative(const ModelSet& models, const Parameter& p); 00062 }; 00063 00064 inline double PdfPoint::probability(const ModelSet& models) const 00065 { 00066 return exp(-0.5*_degreesOfFreedom*models.misfit(_cell)[0]); 00067 //return models.misfit(_cell); 00068 } 00069 00070 } // namespace DinverCore 00071 00072 #endif // PDFCURVE_H