Bayesian Filtering Library  Generated from SVN r
uniform.h
1 // $Id: uniform.h tdelaet$
2 // Copyright (C) 2007 Tinne De Laet <first dot last at gmail dot com>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation; either version 2.1 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 #ifndef UNIFORM_H
19 #define UNIFORM_H
20 
21 #include "pdf.h"
22 
23 namespace BFL
24 {
26  class Uniform: public Pdf<MatrixWrapper::ColumnVector>
27  {
28  private:
34  double _Height; //the height of the uniform distribution
35 
36  // variables to avoid allocation on the heap during resampling
37  mutable ColumnVector _samples;
38 
39  public:
41 
46 
48  Uniform (int dimension = 0);
49 
51 
53  virtual ~Uniform();
54 
56  friend std::ostream& operator<< (std::ostream& os, const Uniform& u);
57 
59  virtual Uniform* Clone() const;
60 
61  // Redefinition of pure virtuals
62  virtual Probability ProbabilityGet(const MatrixWrapper::ColumnVector& input) const;
63  bool SampleFrom (vector<Sample<MatrixWrapper::ColumnVector> >& list_samples,
64  const unsigned int num_samples,
65  const SampleMthd method=SampleMthd::DEFAULT,
66  void * args=NULL) const;
67  virtual bool SampleFrom (Sample<MatrixWrapper::ColumnVector>& one_sample, const SampleMthd method=SampleMthd::DEFAULT, void * args=NULL) const;
68 
70 
72  virtual MatrixWrapper::ColumnVector CenterGet() const;
73 
75 
77  virtual MatrixWrapper::ColumnVector WidthGet() const;
78 
80 
84  void UniformSet (const MatrixWrapper::ColumnVector& center, const MatrixWrapper::ColumnVector& width);
85 
86  };
87 
88 } // end namespace
89 #endif
virtual Probability ProbabilityGet(const MatrixWrapper::ColumnVector &input) const
Get the probability of a certain argument.
Class PDF: Virtual Base class representing Probability Density Functions.
Definition: pdf.h:50
virtual ~Uniform()
Default Copy Constructor will do.
Class representing uniform density.
Definition: uniform.h:26
void UniformSet(const MatrixWrapper::ColumnVector &center, const MatrixWrapper::ColumnVector &width)
Set the center and width of the uniform.
virtual MatrixWrapper::ColumnVector CenterGet() const
Get the center of the uniform.
Wrapper class for ColumnVectors (Boost implementation)
Definition: asirfilter.h:41
virtual Uniform * Clone() const
Clone function.
Uniform(const MatrixWrapper::ColumnVector &Center, const MatrixWrapper::ColumnVector &Width)
Constructor.
friend std::ostream & operator<<(std::ostream &os, const Uniform &u)
output stream for Uniform distribution
virtual MatrixWrapper::ColumnVector WidthGet() const
Get the Width of the uniform distribution.
Class representing a probability (a double between 0 and 1)
Definition: bfl_constants.h:37