47 #ifndef _MIRA_NORMALRANDOMGENERATOR_H_ 48 #define _MIRA_NORMALRANDOMGENERATOR_H_ 56 #include <boost/random/uniform_01.hpp> 66 class NormalRandomDistributionBase
70 NormalRandomDistributionBase() : first(true) {}
77 template <
typename Engine>
82 u = boost::uniform_01<T>()(eng);
83 v = boost::uniform_01<T>()(eng);
84 sqrt_2ln_u = std::sqrt(-T(2) * std::log(T(1)-u));
90 return sqrt_2ln_u * (first ? std::sin(T(2)*pi<T>()*v) :
91 std::cos(T(2)*pi<T>()*v));
124 template <
int D,
typename T=
float>
130 typedef detail::NormalRandomDistributionBase<T>
Base;
137 mL = VarianceType::Identity();
157 auto llt = sigma.llt();
158 if(llt.info()!=Eigen::Success)
167 template <
typename Engine>
171 n(i) = this->normal(eng);
180 template <
typename T>
203 template <
typename Engine>
205 return mSigma * this->normal(eng);
238 template <
int D,
typename T=
float>
T VarianceType
Definition: NormalRandomGenerator.h:187
Eigen::Matrix< T, D, D > VarianceType
Definition: NormalRandomGenerator.h:132
#define MIRA_PPARAM(...)
Preprocessor workaround to handle single parameters that contain a comma.
Definition: PParam.h:61
Include file for all eigen related things.
Includes often needed math headers and methods and provides additional constants. ...
T input_type
Definition: NormalRandomGenerator.h:128
NormalRandomDistribution()
Definition: NormalRandomGenerator.h:136
Preprocessor workaround to handle single parameters that contain a comma.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Eigen::Matrix< T, D, 1 > result_type
Definition: NormalRandomGenerator.h:129
NormalRandomDistribution(const Eigen::Matrix< T, D, D > &sigma)
Definition: NormalRandomGenerator.h:140
Template class to easily generate random generators using the boost::random distributions and generat...
Definition: RandomGenerator.h:96
void setSigma(T sigma)
Sets the specified covariance matrix.
Definition: NormalRandomGenerator.h:198
detail::NormalRandomDistributionBase< T > Base
Definition: NormalRandomGenerator.h:130
NormalRandomGenerator()
Definition: NormalRandomGenerator.h:243
NormalRandomDistribution(T sigma)
Definition: NormalRandomGenerator.h:193
T result_type
Definition: NormalRandomGenerator.h:185
NormalRandomDistribution()
Definition: NormalRandomGenerator.h:191
Eigen::Matrix< T, D, 1 > operator()(Engine &eng)
Draws a sample from the normal distribution.
Definition: NormalRandomGenerator.h:168
bool setSigma(const Eigen::Matrix< T, D, D > &sigma)
Sets the specified covariance matrix.
Definition: NormalRandomGenerator.h:155
T operator()(Engine &eng)
Definition: NormalRandomGenerator.h:204
Random distribution for drawing samples from univariate or multivariate normal distributions.
Definition: NormalRandomGenerator.h:125
T input_type
Definition: NormalRandomGenerator.h:184
#define MIRA_RANDOM_GENERATOR_COMMON(Derived, TDistribution)
Macro to be used in derived random generators to supply the default interface such copy constructors ...
Definition: RandomGenerator.h:249
Random generator for drawing samples from univariate or multivariate normal distributions.
Definition: NormalRandomGenerator.h:239
Helper singleton to easily generate random generators using the boost::random distributions and gener...