00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <itpp/itbase.h>
00013
00014 using std::cout;
00015 using std::endl;
00016
00017 namespace itpp {
00018 Array<int> to_Arr(const ivec &indices);
00019
00024 class Gamma_RNG {
00025 public:
00027 Gamma_RNG(double a=1.0, double b=1.0);
00029 void setup(double a0, double b0) { alpha=a0; beta=b0;}
00031 double get_setup() const;
00033 double operator()() { return sample(); }
00035 vec operator()(int n);
00037 mat operator()(int h, int w);
00038 protected:
00039 private:
00041 double sample();
00043 double alpha;
00045 double beta;
00047 Random_Generator RNG;
00048 Normal_RNG NRNG;
00050 inline double exp_rand(){return -std::log(RNG.random_01());}
00051 inline double unif_rand(){return RNG.random_01();}
00052 inline double norm_rand(){return NRNG.sample();}
00053
00054 };
00055 }