00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #include <itpp/itbase.h>
00013 
00014 #ifndef ITEX_H
00015 #define ITEX_H 
00016 
00017 using std::cout;
00018 using std::endl;
00019 
00020 namespace itpp {
00021 Array<int> to_Arr ( const ivec &indices );
00022 ivec linspace ( int from, int to ); 
00023 
00028 class Gamma_RNG {
00029 public:
00031 Gamma_RNG ( double a=1.0, double b=1.0 );
00033         void setup ( double a0, double b0 ) { alpha=a0; beta=b0;}
00035         double get_setup() const;
00037         double operator() () { return sample(); }
00039         vec operator() ( int n );
00041         mat operator() ( int h, int w );
00042 protected:
00043 private:
00045         double sample();
00047         double alpha;
00049         double beta;
00051         Random_Generator RNG;
00052         Normal_RNG NRNG;
00054         inline double exp_rand() {return -std::log ( RNG.random_01() );}
00055         inline double unif_rand() {return RNG.random_01();}
00056         inline double norm_rand() {return NRNG.sample();}
00057 
00058 };
00059 
00060 bool qr ( const mat &A, mat &R );
00061 
00062 }
00063 #endif //ITEX_H