discretepdf.h
Go to the documentation of this file.
00001 // $Id: discretepdf.h 29890 2009-02-02 10:22:01Z tdelaet $
00002 // Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com>
00003 //               2008 Tinne De Laet <first dot last at mech dot kuleuven dot be>
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU Lesser General Public License as published by
00007 // the Free Software Foundation; either version 2.1 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 //
00019 #ifndef DISCRETEPDF_H
00020 #define DISCRETEPDF_H
00021 
00022 #include "pdf.h"
00023 #include "../wrappers/matrix/vector_wrapper.h"
00024 #include "../wrappers/matrix/matrix_wrapper.h"
00025 #include <vector>
00026 
00027 namespace BFL
00028 {
00030 
00034   class DiscretePdf : public Pdf<int> // inherit abstract_template_class
00035     {
00036     protected:
00038       unsigned int _num_states;
00039 
00041       vector<Probability> *_Values_p;
00042 
00044       bool NormalizeProbs();
00045 
00047       vector<double> _CumPDF;
00048 
00050       bool CumPDFUpdate();
00051 
00052     public:
00054 
00056       DiscretePdf(unsigned int num_states=0);
00057 
00059       DiscretePdf(const DiscretePdf &);
00060 
00062       virtual ~DiscretePdf();
00063 
00065       virtual DiscretePdf* Clone() const;
00066 
00068       unsigned int NumStatesGet()const;
00069 
00071       Probability ProbabilityGet(const int& state) const;
00072 
00074 
00080       bool ProbabilitySet(int state, Probability a);
00081 
00082       bool SampleFrom (vector<Sample<int> >& list_samples,
00083                        const unsigned int num_samples,
00084                        int method = DEFAULT,
00085                        void * args = NULL) const;
00086       bool SampleFrom (Sample<int>& one_sample, int method = DEFAULT, void * args = NULL) const;
00087 
00089       vector<Probability> ProbabilitiesGet() const;
00090 
00092 
00096       bool ProbabilitiesSet(vector<Probability> & values);
00097 
00099       int MostProbableStateGet();
00100 
00101     };
00102 
00103 } // End namespace
00104 
00105 #endif // DISCRETEPDF_H


bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Sun Oct 5 2014 22:29:52