uniform.h
Go to the documentation of this file.
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:
30  MatrixWrapper::ColumnVector _Lower;
32  MatrixWrapper::ColumnVector _Higher;
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 
45  Uniform (const MatrixWrapper::ColumnVector& Center, const MatrixWrapper::ColumnVector& Width);
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 int num_samples,
65  int method=DEFAULT,
66  void * args=NULL) const;
67  virtual bool SampleFrom (Sample<MatrixWrapper::ColumnVector>& one_sample, int method=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
bool SampleFrom(vector< Sample< MatrixWrapper::ColumnVector > > &list_samples, const int num_samples, int method=DEFAULT, void *args=NULL) const
Class PDF: Virtual Base class representing Probability Density Functions.
Definition: pdf.h:53
#define DEFAULT
Class representing uniform density.
Definition: uniform.h:26
virtual ~Uniform()
Default Copy Constructor will do.
Definition: uniform.cpp:52
virtual MatrixWrapper::ColumnVector WidthGet() const
Get the Width of the uniform distribution.
Definition: uniform.cpp:123
ColumnVector _samples
Definition: uniform.h:37
Uniform(const MatrixWrapper::ColumnVector &Center, const MatrixWrapper::ColumnVector &Width)
Constructor.
virtual MatrixWrapper::ColumnVector CenterGet() const
Get the center of the uniform.
Definition: uniform.cpp:117
friend std::ostream & operator<<(std::ostream &os, const Uniform &u)
output stream for Uniform distribution
Definition: uniform.cpp:54
double _Height
Height of the uniform distribution.
Definition: uniform.h:34
virtual Uniform * Clone() const
Clone function.
Definition: uniform.cpp:62
void UniformSet(const MatrixWrapper::ColumnVector &center, const MatrixWrapper::ColumnVector &width)
Set the center and width of the uniform.
Definition: uniform.cpp:129
virtual Probability ProbabilityGet(const MatrixWrapper::ColumnVector &input) const
Get the probability of a certain argument.
Definition: uniform.cpp:67
Class representing a probability (a double between 0 and 1)
Definition: bfl_constants.h:39
MatrixWrapper::ColumnVector _Higher
Upper border of the uniform distribution.
Definition: uniform.h:32
MatrixWrapper::ColumnVector _Lower
Lower border of the uniform distribution.
Definition: uniform.h:30


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:59