Uniform.h
Go to the documentation of this file.
1 /************************************************************************
2  * Copyright (C) 2012 Eindhoven University of Technology (TU/e). *
3  * All rights reserved. *
4  ************************************************************************
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions *
7  * are met: *
8  * *
9  * 1. Redistributions of source code must retain the above *
10  * copyright notice, this list of conditions and the following *
11  * disclaimer. *
12  * *
13  * 2. Redistributions in binary form must reproduce the above *
14  * copyright notice, this list of conditions and the following *
15  * disclaimer in the documentation and/or other materials *
16  * provided with the distribution. *
17  * *
18  * THIS SOFTWARE IS PROVIDED BY TU/e "AS IS" AND ANY EXPRESS OR *
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
21  * ARE DISCLAIMED. IN NO EVENT SHALL TU/e OR CONTRIBUTORS BE LIABLE *
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
24  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
28  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
29  * DAMAGE. *
30  * *
31  * The views and conclusions contained in the software and *
32  * documentation are those of the authors and should not be *
33  * interpreted as representing official policies, either expressed or *
34  * implied, of TU/e. *
35  ************************************************************************/
36 
37 #ifndef PROBLIB_UNIFORMPDF_H_
38 #define PROBLIB_UNIFORMPDF_H_
39 
40 #include "PDF.h"
41 
42 namespace pbl {
43 
51 class Uniform: public PDF {
52 
53 public:
54 
60  Uniform(int dim);
61 
62 
69  Uniform(int dim, double density);
70 
79 
83  Uniform(const Uniform& pdf);
84 
88  virtual ~Uniform();
89 
95  Uniform& operator=(const Uniform& other);
96 
102  Uniform* clone() const;
103 
104  double getLikelihood(const PDF& pdf) const;
105 
111  void setDensity(const double& density);
112 
119  double getDensity(const arma::vec& vec) const;
120 
125  double getMaxDensity() const;
126 
131  void setMean(const pbl::Vector mean);
132 
137  void setSize(const pbl::Vector size);
138 
144  std::string toString(const std::string& indent = "") const;
145 
146 protected:
147 
149 
151 
153 
155 
157 
158 };
159 
160 }
161 
162 #endif /* UNIFORMPDF_H_ */
pbl::Vector mean_
Definition: Uniform.h:148
double uniform_probability_
Definition: Uniform.h:152
Uniform(int dim)
Constructs a uniform distribution with known dimensionality but unknown size and density.
Definition: Uniform.cpp:42
pbl::Vector size_
Definition: Uniform.h:150
void setMean(const pbl::Vector mean)
Set the mean of the volume representing this uniform distribution.
Definition: Uniform.cpp:136
Uniform * clone() const
Creates a clone of the object. The clone method is cheap since it only copies a pointer. A deep clone will only be created if the original object is modified.
Definition: Uniform.cpp:70
uword size() const
arma::vec Vector
Definition: datatypes.h:44
Uniform & operator=(const Uniform &other)
Assignment operator. The operation is cheap since it only copies a pointer. A deep clone will only be...
Definition: Uniform.cpp:59
arma_inline const Op< T1, op_mean > mean(const Base< typename T1::elem_type, T1 > &X, const uword dim=0)
double getMaxDensity() const
Returns the maximum density of this distribution, which always equals 1 / volume. ...
Definition: Uniform.cpp:132
std::string toString(const std::string &indent="") const
Represents the uniform distribution as a string for easier console output.
Definition: Uniform.cpp:154
virtual ~Uniform()
Destructor.
Definition: Uniform.cpp:56
void setDensity(const double &density)
Sets the density of the uniform distribution.
Definition: Uniform.cpp:123
void setSize(const pbl::Vector size)
Set the size of the volume representing this uniform distribution.
Definition: Uniform.cpp:140
double getDensity(const arma::vec &vec) const
Calculates the density of the distribution at point v. Will always return the same density if v is in...
Definition: Uniform.cpp:128
This class represents a hyper-cube shaped uniform distribution.
Definition: Uniform.h:51
Definition: PDF.h:47
Vec< double > vec
Col< double > vec
double getLikelihood(const PDF &pdf) const
Definition: Uniform.cpp:74
void calculateUniformDensity()
Definition: Uniform.cpp:145
bool size_is_set_
Definition: Uniform.h:154


problib
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:19