discreteconditionalpdf.h
Go to the documentation of this file.
1 // $Id$
2 // Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com>
3 // 2008 Tinne De Laet <first dot last at mech dot kuleuven dot be>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 2.1 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 
20 #ifndef __DISCRETE_CONDITIONAL_PDF__
21 #define __DISCRETE_CONDITIONAL_PDF__
22 
23 #include "conditionalpdf.h"
24 
25 namespace BFL
26 {
27 
29 
53  class DiscreteConditionalPdf : public ConditionalPdf<int, int>
54  {
55  protected:
57  unsigned int _num_states;
58 
60 
63  double * _probability_p;
66 
69 
71  int IndexGet(const int& input, const std::vector<int>& condargs) const;
72 
73  // variables to prevent memory allocation on the heap during call of
74  //SampleFrom
75  mutable std::vector<double> _probs;
76  mutable std::vector<double> _valuelist;
77 
78  public:
80 
90  DiscreteConditionalPdf(int num_states=1,
91  int num_conditional_arguments=1,
92  int cond_arg_dimensions[] = NULL);
96  virtual ~DiscreteConditionalPdf();
97 
99  virtual DiscreteConditionalPdf* Clone() const;
100 
102  unsigned int NumStatesGet()const;
103 
104  // Redefine all pure virtuals!
105  Probability ProbabilityGet(const int& input) const;
106  virtual bool SampleFrom (Sample<int>& one_sample, int method, void * args) const;
107  virtual bool SampleFrom (vector<Sample<int> >& list_samples, int num_samples, int method, void * args) const;
108 
110  void ProbabilitySet(const double& prob, const int& input, const std::vector<int>& condargs) const;
111 
112 
113  };
114 
115 } // End namespace BFL
116 
117 #endif // __DISCRETE_CONDITIONAL_PDF__
unsigned int _num_states
number of discrete states
virtual bool SampleFrom(Sample< int > &one_sample, int method, void *args) const
Draw 1 sample from the Pdf:
int * _cond_arg_dims_p
"Possible discrete states" of all the conditional arguments
virtual ~DiscreteConditionalPdf()
Destructor.
DiscreteConditionalPdf(int num_states=1, int num_conditional_arguments=1, int cond_arg_dimensions[]=NULL)
Constructor.
double * _probability_p
Pointer to the probability values.
Abstract Class representing conditional Pdfs P(x | ...)
Probability ProbabilityGet(const int &input) const
Get the probability of a certain argument.
Abstract Class representing all FULLY Discrete Conditional PDF&#39;s.
std::vector< double > _valuelist
int _total_dimension
Total dimension of the likelihoodtable.
Class representing a probability (a double between 0 and 1)
Definition: bfl_constants.h:39
virtual DiscreteConditionalPdf * Clone() const
Clone function.
void ProbabilitySet(const double &prob, const int &input, const std::vector< int > &condargs) const
Set the probability (Typical for discrete Pdf&#39;s)
unsigned int NumStatesGet() const
Get the number of discrete states.
int IndexGet(const int &input, const std::vector< int > &condargs) const
Get the correct index in the row of doubles (double * probability)


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 Mon Jun 10 2019 12:47:58